merge with updates from upstream

This commit is contained in:
Nishanth Samala committed 2020-02-05 15:47:50 -05:00
commit 59dcead893
299 files changed
+66956 -35629

No files matched your search

@@ -0,0 +1,82 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D13
30, // D0 is P0.30 (GPIO D0 / A6 / UART RX)
14, // D1 is P0.14 (GPIO D1 / UART TX)
5, // D2 is P0.05 (GPIO D2 / A5 / SDA)
4, // D3 is P0.04 (GPIO D3 / A4 / SCL)
34, // D4 is P1.02 (GPIO D4 / Left Button)
47, // D5 is P1.15 (GPIO D5 / Right button)
2, // D6 is P0.02 (GPIO D6 / A1)
38, // D7 is P1.06 (GPIO D7 / Slide Switch)
13, // D8 is P0.13 (GPIO D8 / NeoPixels)
29, // D9 is P0.29 (GPIO D9 / A2)
3, // D10 is P0.03 (GPIO D10 / A3)
36, // D11 is P1.04 (GPIO D11 / Speaker Shutdown)
26, // D12 is P0.26 (GPIO D12 / Audio Out)
46, // D13 is P1.14 (GPIO D13 / Red LED)
// D14 .. D23
26, // NOT REALLY ANALOG, A PLACEHODER SINCE D12 is not analog
2, // D6 is P0.02 (GPIO D6 / A1)
29, // D9 is P0.29 (GPIO D9 / A2)
3, // D10 is P0.03 (GPIO D10 / A3)
4, // D3 is P0.04 (GPIO D3 / A4 / SCL)
5, // D2 is P0.05 (GPIO D2 / A5 / SDA)
30, // D0 is P0.30 (GPIO D0 / A6 / UART RX)
14, // NOT REALLY ANALOG, A PLACEHODER SINCE D1 is not analog
28, // A8 - Light sensor
31, // A9 - Thermistor sensor
// D24 & D25 PDM pins
16, // D24 is P0.16 (PDM DAT)
17, // D25 is P0.17 (PDM CLK)
44, // D26 is P1.12 (LIS SCL)
45, // D27 is P1.13 (LIS IRQ)
42, // D28 is P1.10 (LIS SDA)
// QSPI pins (not exposed via any header / test point)
19, // D29 is P0.19 (QSPI CLK)
15, // D30 is P0.15 (QSPI CS)
21, // D31 is P0.21 (QSPI Data 0)
23, // D32 is P0.23 (QSPI Data 1)
32, // D33 is P1.00 (QSPI Data 2)
22, // D34 is P0.22 (QSPI Data 3)
// D35 power switch
6, // D36 is P0.06 (NeoPixel / Sensor switch)
};
void initVariant()
{
// LED1
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
}
@@ -0,0 +1,151 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_CIRCUITPLAY52840_
#define _VARIANT_CIRCUITPLAY52840_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
//#define USE_LFXO // Board uses 32khz crystal for LF
#define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (36)
#define NUM_DIGITAL_PINS (36)
#define NUM_ANALOG_INPUTS (8)
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (13)
#define PIN_NEOPIXEL (8)
#define LED_BUILTIN PIN_LED1
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED1
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
#define PIN_BUTTON1 (4)
#define PIN_BUTTON2 (5)
// Microphone
#define PIN_PDM_DIN 24
#define PIN_PDM_CLK 25
#define PIN_PDM_PWR -1 // not used
/*
* Analog pins
*/
#define PIN_A0 (14) // not really analog!
#define PIN_A1 (15)
#define PIN_A2 (16)
#define PIN_A3 (17)
#define PIN_A4 (18)
#define PIN_A5 (19)
#define PIN_A6 (20)
#define PIN_A7 (21) // not really analog!
#define PIN_A8 (22)
#define PIN_A9 (23)
static const uint8_t A0 = PIN_A0 ;
static const uint8_t A1 = PIN_A1 ;
static const uint8_t A2 = PIN_A2 ;
static const uint8_t A3 = PIN_A3 ;
static const uint8_t A4 = PIN_A4 ;
static const uint8_t A5 = PIN_A5 ;
static const uint8_t A6 = PIN_A6 ;
static const uint8_t A7 = PIN_A7 ;
static const uint8_t A8 = PIN_A8 ;
static const uint8_t A9 = PIN_A9 ;
#define ADC_RESOLUTION 14
/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX (0)
#define PIN_SERIAL1_TX (1)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (10)
#define PIN_SPI_MOSI (2)
#define PIN_SPI_SCK (3)
static const uint8_t SS = (0);
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 2
#define PIN_WIRE_SDA (2)
#define PIN_WIRE_SCL (3)
#define PIN_WIRE1_SDA (28)
#define PIN_WIRE1_SCL (26)
/*
* QSPI Interfaces
*/
#define PIN_QSPI_SCK 29
#define PIN_QSPI_CS 30
#define PIN_QSPI_IO0 31
#define PIN_QSPI_IO1 32
#define PIN_QSPI_IO2 33
#define PIN_QSPI_IO3 34
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_USE_QSPI
/*
* PDM Interfaces
*/
#define PIN_PDM_DIN 24
#define PIN_PDM_CLK 25
#define PIN_PDM_PWR -1 // not used
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
+93
View File
@@ -0,0 +1,93 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D20
4, // D0 is P0.04 (GPIO D0 / AIN2 / UART RX)
5, // D1 is P0.05 (GPIO D1 / AIN3 / UART TX)
3, // D2 is P0.03 (GPIO D2 / AIN4)
28, // D3 is P0.28 (GPIO D3 / AIN5)
2, // D4 is P0.02 (GPIO D4 / AIN6)
34, // D5 is P1.02 (GPIO D5 / Left button)
41, // D6 is P1.09 (GPIO D6)
7, // D7 is P0.07 (GPIO D7)
39, // D8 is P1.07 (GPIO D8)
27, // D9 is P0.27 (GPIO D9)
30, // D10 is P0.30 (GPIO D10 / AIN7)
42, // D11 is P1.10 (GPIO D11 / Right Button)
31, // D12 is P0.31 (GPIO D12 / AIN0)
8, // D13 is P0.08 (GPIO D13 / SCK)
6, // D14 is P0.06 (GPIO D14 / MISO)
26, // D15 is P0.26 (GPIO D15 / MOSI)
29, // D16 is P0.29 (GPIO D16 / AIN1)
33, // D17 is P1.01 (Red LED)
16, // D18 is P0.16 (NeoPixel)
25, // D19 is P0.25 (GPIO D19 / SCL)
24, // D20 is P0.24 (GPIO D20 / SDA)
// D21..D28 (A0 to A7)
31, // D12 is P0.31 (GPIO D12 / AIN0)
29, // D16 is P0.29 (GPIO D16 / AIN1)
4, // D0 is P0.04 (GPIO D0 / AIN2 / UART RX)
5, // D1 is P0.05 (GPIO D1 / AIN3 / UART TX)
3, // D2 is P0.03 (GPIO D2 / AIN4)
28, // D3 is P0.28 (GPIO D3 / AIN5)
2, // D4 is P0.02 (GPIO D4 / AIN6)
30, // D10 is P0.30 (GPIO D10 / AIN7)
// D29 .. D34 - TFT control
14, // P0.14 (TFT SCK)
15, // P0.15 (TFT MOSI)
12, // P0.12 (TFT CS)
13, // P0.13 (TFT DC)
35, // P1.03 (TFT RESET)
37, // P1.05 (TFT LITE)
// 35 & 36 - PDM mic
0, // D35 is P0.00 (PDM DAT)
1, // D36 is P0.01 (PDM CLK)
// QSPI pins (not exposed via any header / test point)
19, // D37 is P0.19 (QSPI CLK)
20, // D38 is P0.20 (QSPI CS)
17, // D39 is P0.17 (QSPI Data 0)
22, // D40 is P0.22 (QSPI Data 1)
23, // D41 is P0.23 (QSPI Data 2)
21, // D42 is P0.21 (QSPI Data 3)
10, // D43 is P0.10 white LED control
9, // D44 is P0.09 APDS IRQ
38, // D45 is P1.06 LSM6DS33 IRQ
32, // D46 is P1.00 Speaker/buzzer
};
void initVariant()
{
// LED1
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
}
+144
View File
@@ -0,0 +1,144 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_CLUE52840_
#define _VARIANT_CLUE52840_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (47)
#define NUM_DIGITAL_PINS (47)
#define NUM_ANALOG_INPUTS (8)
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (17)
#define PIN_NEOPIXEL (18)
#define LED_BUILTIN PIN_LED1
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED1
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
#define PIN_BUTTON1 (5)
#define PIN_BUTTON2 (11)
// Microphone
#define PIN_PDM_DIN 35
#define PIN_PDM_CLK 36
#define PIN_PDM_PWR -1 // not used
/*
* Analog pins
*/
#define PIN_A0 (21)
#define PIN_A1 (22)
#define PIN_A2 (23)
#define PIN_A3 (24)
#define PIN_A4 (25)
#define PIN_A5 (26)
#define PIN_A6 (27)
#define PIN_A7 (28)
static const uint8_t A0 = PIN_A0 ;
static const uint8_t A1 = PIN_A1 ;
static const uint8_t A2 = PIN_A2 ;
static const uint8_t A3 = PIN_A3 ;
static const uint8_t A4 = PIN_A4 ;
static const uint8_t A5 = PIN_A5 ;
static const uint8_t A6 = PIN_A6 ;
static const uint8_t A7 = PIN_A7 ;
#define ADC_RESOLUTION 14
/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX (0)
#define PIN_SERIAL1_TX (1)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 2
#define PIN_SPI_MISO (14)
#define PIN_SPI_MOSI (15)
#define PIN_SPI_SCK (13)
static const uint8_t SS = (16);
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
#define PIN_SPI1_MISO (35)
#define PIN_SPI1_MOSI (30)
#define PIN_SPI1_SCK (29)
static const uint8_t SS1 = (31);
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
static const uint8_t MISO1 = PIN_SPI1_MISO ;
static const uint8_t SCK1 = PIN_SPI1_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (20)
#define PIN_WIRE_SCL (19)
// QSPI Pins
#define PIN_QSPI_SCK 37
#define PIN_QSPI_CS 38
#define PIN_QSPI_IO0 39
#define PIN_QSPI_IO1 40
#define PIN_QSPI_IO2 41
#define PIN_QSPI_IO3 42
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
-1
View File
@@ -67,7 +67,6 @@ const uint32_t g_ADigitalPinMap[] = {
29, // A5
30, // A6
31, // A7
};
void initVariant()
+1 -2
View File
@@ -87,7 +87,6 @@ static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
// Serial
#define PIN_SERIAL_RX (8)
#define PIN_SERIAL_TX (6)
@@ -100,7 +99,7 @@ static const uint8_t AREF = PIN_AREF;
#define PIN_SPI_MOSI (13)
#define PIN_SPI_SCK (12)
static const uint8_t SS = 18 ;
static const uint8_t SS = 27 ;
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
+6 -12
View File
@@ -55,13 +55,10 @@ extern "C"
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
/*
#define PIN_BUTTON1 (2)
#define PIN_BUTTON2 (3)
#define PIN_BUTTON3 (4)
#define PIN_BUTTON4 (5)
*/
* Buttons
*/
#define PIN_BUTTON1 (7)
/*
* Analog pins
@@ -96,9 +93,8 @@ static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
// Serial
#define PIN_SERIAL_RX (1)
#define PIN_SERIAL_TX (0)
#define PIN_SERIAL1_RX (1)
#define PIN_SERIAL1_TX (0)
/*
* SPI Interfaces
@@ -132,9 +128,7 @@ static const uint8_t SCK = PIN_SPI_SCK ;
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define USB_MSC_BLOCK_SIZE 512
#define USB_MSC_BLOCK_COUNT ((2*1024*1024) / USB_MSC_BLOCK_SIZE)
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
+104
View File
@@ -0,0 +1,104 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D13
25, // D0 is P0.25 (UART TX)
24, // D1 is P0.24 (UART RX
10, // D2 is P0.10 (NFC2)
43, // D3 is P1.11 (LED1)
42, // D4 is P1.10 (LED2)
40, // D5 is P1.08
7, // D6 is P0.07
34, // D7 is P1.02 (Button)
16, // D8 is P0.16 (NeoPixel)
26, // D9 is P0.26
27, // D10 is P0.27
6, // D11 is P0.06
8, // D12 is P0.08
41, // D13 is P1.09
// D14 .. D21 (aka A0 .. A7)
4, // D14 is P0.04 (A0)
5, // D15 is P0.05 (A1)
30, // D16 is P0.30 (A2)
28, // D17 is P0.28 (A3)
2, // D18 is P0.02 (A4)
3, // D19 is P0.03 (A5)
29, // D20 is P0.29 (A6, Battery)
31, // D21 is P0.31 (A7, ARef)
// D22 .. D23 (aka I2C pins)
12, // D22 is P0.12 (SDA)
11, // D23 is P0.11 (SCL)
// D24 .. D26 (aka SPI pins)
15, // D24 is P0.15 (SPI MISO)
13, // D25 is P0.13 (SPI MOSI)
14, // D26 is P0.14 (SPI SCK )
// QSPI pins (not exposed via any header / test point)
19, // D27 is P0.19 (QSPI CLK)
20, // D28 is P0.20 (QSPI CS)
17, // D29 is P0.17 (QSPI Data 0)
22, // D30 is P0.22 (QSPI Data 1)
23, // D31 is P0.23 (QSPI Data 2)
21, // D32 is P0.21 (QSPI Data 3)
// The remaining NFC pin
9, // D33 is P0.09 (NFC1, exposed only via test point on bottom of board)
0, // D34 P0.00 is PDM Data
1, // D35 P0.01 is PDM Clock
32, // D36 P1.00 is APDS IRQ
// The remaining pins are not usable:
// The following pins were never listed as they were considered unusable
// 18, // P0.18 is RESET (attached to switch)
//
// The remaining pins are not connected (per schematic)
// 33, // P1.01 is not connected per schematic
// 35, // P1.03 is not connected per schematic
// 36, // P1.04 is not connected per schematic
// 37, // P1.05 is not connected per schematic
// 38, // P1.06 is not connected per schematic
// 39, // P1.07 is not connected per schematic
// 43, // P1.11 is not connected per schematic
// 44, // P1.12 is not connected per schematic
// 45, // P1.13 is not connected per schematic
// 46, // P1.14 is not connected per schematic
};
void initVariant()
{
// LED1 & LED2
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
}
+145
View File
@@ -0,0 +1,145 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_FEATHER52840_SENSE_
#define _VARIANT_FEATHER52840_SENSE_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (37)
#define NUM_DIGITAL_PINS (37)
#define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (3)
#define PIN_LED2 (4)
#define PIN_NEOPIXEL (8)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED2
#define LED_STATE_ON 1 // State when LED is litted
/*
* Buttons
*/
#define PIN_BUTTON1 (7)
// Microphone
#define PIN_PDM_DIN 34
#define PIN_PDM_CLK 35
#define PIN_PDM_PWR -1 // not used
/*
* Analog pins
*/
#define PIN_A0 (14)
#define PIN_A1 (15)
#define PIN_A2 (16)
#define PIN_A3 (17)
#define PIN_A4 (18)
#define PIN_A5 (19)
#define PIN_A6 (20)
#define PIN_A7 (21)
static const uint8_t A0 = PIN_A0 ;
static const uint8_t A1 = PIN_A1 ;
static const uint8_t A2 = PIN_A2 ;
static const uint8_t A3 = PIN_A3 ;
static const uint8_t A4 = PIN_A4 ;
static const uint8_t A5 = PIN_A5 ;
static const uint8_t A6 = PIN_A6 ;
static const uint8_t A7 = PIN_A7 ;
#define ADC_RESOLUTION 14
// Other pins
#define PIN_AREF PIN_A7
#define PIN_VBAT PIN_A6
#define PIN_NFC1 (33)
#define PIN_NFC2 (2)
static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX (1)
#define PIN_SERIAL1_TX (0)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (24)
#define PIN_SPI_MOSI (25)
#define PIN_SPI_SCK (26)
static const uint8_t SS = (5);
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (22)
#define PIN_WIRE_SCL (23)
// QSPI Pins
#define PIN_QSPI_SCK 27
#define PIN_QSPI_CS 28
#define PIN_QSPI_IO0 29
#define PIN_QSPI_IO1 30
#define PIN_QSPI_IO2 31
#define PIN_QSPI_IO3 32
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
@@ -0,0 +1,104 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D13
25, // D0 is P0.25 (UART RX)
24, // D1 is P0.24 (UART TX)
34, // D2 is P1.02
6, // D3 is P0.06 LED
29, // D4 is P0.29 Button
27, // D5 is P0.27
41, // D6 is P1.09 (DotStar Clock)
40, // D7 is P1.08
8, // D8 is P0.08 (DotStar Data)
7, // D9 is P0.07
5, // D10 is P0.05
26, // D11 is P0.26
11, // D12 is P0.11
12, // D13 is P0.12
// D14 .. D20 (aka A0 .. A7)
4, // D14 is P0.04 (A0)
30, // D15 is P0.30 (A1)
28, // D16 is P0.28 (A2)
31, // D17 is P0.31 (A3)
2, // D18 is P0.02 (A4)
3, // D19 is P0.03 (A5)
// Extra Analog pin #20
5, // D20 is P0.05 (A6/D10)
// D21 .. D22 (aka I2C pins)
16, // D21 is P0.16 (SDA)
14, // D22 is P0.14 (SCL)
// D23 .. D25 (aka SPI pins)
20, // D23 is P0.20 (SPI MISO)
15, // D24 is P0.15 (SPI MOSI)
13, // D25 is P0.13 (SPI SCK )
// QSPI pins (not exposed via any header / test point)
19, // D26 is P0.19 (QSPI CLK)
23, // D27 is P0.23 (QSPI CS)
21, // D28 is P0.21 (QSPI Data 0)
22, // D29 is P0.22 (QSPI Data 1)
32, // D30 is P1.00 (QSPI Data 2)
17, // D31 is P0.17 (QSPI Data 3)
// Thus, there are 32 defined pins
// The remaining pins are not usable:
//
//
// The following pins were never listed as they were considered unusable
// 0, // P0.00 is XL1 (attached to 32.768kHz crystal)
// 1, // P0.01 is XL2 (attached to 32.768kHz crystal)
// 18, // P0.18 is RESET (attached to switch)
//
// The remaining pins are not connected (per schematic)
// 9, // P0.09 is not connected per schematic
// 10, // P0.10 is not connected per schematic
// 33, // P1.01 is not connected per schematic
// 35, // P1.03 is not connected per schematic
// 36, // P1.04 is not connected per schematic
// 37, // P1.05 is not connected per schematic
// 38, // P1.06 is not connected per schematic
// 39, // P1.07 is not connected per schematic
// 43, // P1.11 is not connected per schematic
// 44, // P1.12 is not connected per schematic
// 45, // P1.13 is not connected per schematic
// 46, // P1.14 is not connected per schematic
// 47, // P1.15 is not connected per schematic
};
void initVariant()
{
// LED1 & LED2
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
}
@@ -0,0 +1,137 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_ITSY52840_
#define _VARIANT_ITSY52840_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
// define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (32)
#define NUM_DIGITAL_PINS (32)
#define NUM_ANALOG_INPUTS (7)
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (3)
#define PIN_DOTSTAR_DATA (8)
#define PIN_DOTSTAR_CLOCK (6)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED1
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED1
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
#define PIN_BUTTON1 (4)
/*
#define PIN_BUTTON2 (3)
#define PIN_BUTTON3 (4)
#define PIN_BUTTON4 (5)
*/
/*
* Analog pins
*/
#define PIN_A0 (14)
#define PIN_A1 (15)
#define PIN_A2 (16)
#define PIN_A3 (17)
#define PIN_A4 (18)
#define PIN_A5 (19)
#define PIN_A6 (20)
#define PIN_A7 (0xff) // to compile with Firmata library
static const uint8_t A0 = PIN_A0 ;
static const uint8_t A1 = PIN_A1 ;
static const uint8_t A2 = PIN_A2 ;
static const uint8_t A3 = PIN_A3 ;
static const uint8_t A4 = PIN_A4 ;
static const uint8_t A5 = PIN_A5 ;
static const uint8_t A6 = PIN_A6 ;
#define ADC_RESOLUTION 14
//static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
#define PIN_SERIAL1_RX (0)
#define PIN_SERIAL1_TX (1)
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MISO (23)
#define PIN_SPI_MOSI (24)
#define PIN_SPI_SCK (25)
static const uint8_t SS = (5);
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
/*
* Wire Interfaces
*/
#define WIRE_INTERFACES_COUNT 1
#define PIN_WIRE_SDA (21)
#define PIN_WIRE_SCL (22)
// QSPI Pins
#define PIN_QSPI_SCK 26
#define PIN_QSPI_CS 27
#define PIN_QSPI_IO0 28
#define PIN_QSPI_IO1 29
#define PIN_QSPI_IO2 30
#define PIN_QSPI_IO3 31
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif
+7 -9
View File
@@ -55,13 +55,11 @@ extern "C"
#define LED_STATE_ON 1 // State when LED is litted
// Buttons
/*
#define PIN_BUTTON1 (2)
#define PIN_BUTTON2 (3)
#define PIN_BUTTON3 (4)
#define PIN_BUTTON4 (5)
*/
* Buttons
*/
#define PIN_BUTTON1 (37)
#define PIN_BUTTON2 (36)
/*
* Analog pins
@@ -96,9 +94,8 @@ static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
// Serial
#define PIN_SERIAL_RX (1)
#define PIN_SERIAL_TX (0)
#define PIN_SERIAL1_RX (1)
#define PIN_SERIAL1_TX (0)
/*
* SPI Interfaces
@@ -133,6 +130,7 @@ static const uint8_t SCK = PIN_SPI_SCK ;
// On-board QSPI Flash
// If EXTERNAL_FLASH_DEVICES is not defined, all supported devices will be used
#define EXTERNAL_FLASH_DEVICES GD25Q16C
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
+11 -36
View File
@@ -53,6 +53,7 @@ const uint32_t g_ADigitalPinMap[] =
_PINNUM(0, 18), // P0.18 (RESET)
};
<<<<<<< HEAD
void initVariant()
{
switch_antenna(false);
@@ -64,6 +65,9 @@ void initVariant()
}
void switch_antenna(bool useExternal) {
=======
static void switch_antenna(bool useExternal) {
>>>>>>> fd02ea28ba967223d8c04ba1719bf59c57a56d5e
if (useExternal) {
digitalWrite(ANTENNA_SWITCH_1, LOW);
digitalWrite(ANTENNA_SWITCH_2, HIGH);
@@ -74,42 +78,11 @@ void switch_antenna(bool useExternal) {
}
}
void led_pwm_init(uint32_t led_index, uint32_t led_pin) {
NRF_PWM_Type* pwm = NRF_PWM0;
pwm->ENABLE = 0;
nrf_gpio_cfg_output(led_pin);
nrf_gpio_pin_write(led_pin, 1 - LED_STATE_ON);
pwm->PSEL.OUT[led_index] = led_pin;
pwm->MODE = PWM_MODE_UPDOWN_Up;
pwm->COUNTERTOP = 0xff;
pwm->PRESCALER = PWM_PRESCALER_PRESCALER_DIV_16;
pwm->DECODER = PWM_DECODER_LOAD_Individual;
pwm->LOOP = 0;
pwm->SEQ[0].PTR = (uint32_t) (led_duty_cycles);
pwm->SEQ[0].CNT = 4; // default mode is Individual --> count must be 4
pwm->SEQ[0].REFRESH = 0;
pwm->SEQ[0].ENDDELAY = 0;
pwm->ENABLE = 1;
pwm->EVENTS_SEQEND[0] = 0;
// pwm->TASKS_SEQSTART[0] = 1;
}
void led_pwm_teardown(void) {
pwm_teardown(NRF_PWM0);
}
void led_pwm_duty_cycle(uint32_t led_index, uint16_t duty_cycle) {
led_duty_cycles[led_index] = duty_cycle;
nrf_pwm_event_clear(NRF_PWM0, NRF_PWM_EVENT_SEQEND0);
nrf_pwm_task_trigger(NRF_PWM0, NRF_PWM_TASK_SEQSTART0);
void initVariant()
{
switch_antenna(false);
}
<<<<<<< HEAD
void ledWrite(uint32_t led_pin, uint8_t value) {
uint32_t index = -1;
@@ -154,4 +127,6 @@ void pwm_teardown(NRF_PWM_Type* pwm) {
pwm->LOOP = 0;
pwm->SEQ[0].PTR = 0;
pwm->SEQ[0].CNT = 0;
}
}
=======
>>>>>>> fd02ea28ba967223d8c04ba1719bf59c57a56d5e
+33 -36
View File
@@ -74,40 +74,40 @@ static const uint8_t D1 = PIN_D1;
static const uint8_t D2 = PIN_D2;
static const uint8_t D3 = PIN_D4;
static const uint8_t D5 = PIN_D5;
static const uint8_t D6 = PIN_D0;
static const uint8_t D7 = PIN_D1;
static const uint8_t D8 = PIN_D2;
static const uint8_t D9 = PIN_D4;
static const uint8_t D10 = PIN_D5;
static const uint8_t D11 = PIN_D0;
static const uint8_t D12 = PIN_D1;
static const uint8_t D13 = PIN_D2;
static const uint8_t D14 = PIN_D4;
static const uint8_t D15 = PIN_D5;
static const uint8_t D16 = PIN_D0;
static const uint8_t D17 = PIN_D1;
static const uint8_t D18 = PIN_D2;
static const uint8_t D19 = PIN_D4;
static const uint8_t D20 = PIN_D5;
static const uint8_t D6 = PIN_D6;
static const uint8_t D7 = PIN_D7;
static const uint8_t D8 = PIN_D8;
static const uint8_t D9 = PIN_D9;
static const uint8_t D10 = PIN_D10;
static const uint8_t D11 = PIN_D11;
static const uint8_t D12 = PIN_D12;
static const uint8_t D13 = PIN_D13;
static const uint8_t D14 = PIN_D14;
static const uint8_t D15 = PIN_D15;
static const uint8_t D16 = PIN_D16;
static const uint8_t D17 = PIN_D17;
static const uint8_t D18 = PIN_D18;
static const uint8_t D19 = PIN_D19;
static const uint8_t D20 = PIN_D20;
// LEDs
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 12)
#define LED_STATE_ON 1
#define LED_PRIMARY_IDX 0
#define LED_RGB_RED_IDX 1
#define LED_RGB_GREEN_IDX 2
#define LED_RGB_BLUE_IDX 3
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 12)
#define LED_STATE_ON 1
#define LED_PRIMARY_IDX 0
#define LED_RGB_RED_IDX 1
#define LED_RGB_GREEN_IDX 2
#define LED_RGB_BLUE_IDX 3
#define LED_RGB_RED_PIN _PINNUM(0, 13)
#define LED_RGB_GREEN_PIN _PINNUM(0, 14)
#define LED_RGB_BLUE_PIN _PINNUM(0, 15)
#define BOARD_RGB_BRIGHTNESS 0x202020
#define LED_RGB_RED_PIN _PINNUM(0, 13)
#define LED_RGB_GREEN_PIN _PINNUM(0, 14)
#define LED_RGB_BLUE_PIN _PINNUM(0, 15)
#define BOARD_RGB_BRIGHTNESS 0x202020
static const uint8_t LED_BUILTIN = LED_PRIMARY_PIN;
static const uint8_t LED_RGB_RED = LED_RGB_RED_PIN;
static const uint8_t LED_RGB_GREEN = LED_RGB_GREEN_PIN;
static const uint8_t LED_RGB_BLUE = LED_RGB_BLUE_PIN;
static const uint8_t LED_BUILTIN = LED_PRIMARY_PIN;
static const uint8_t LED_RGB_RED = LED_RGB_RED_PIN;
static const uint8_t LED_RGB_GREEN = LED_RGB_GREEN_PIN;
static const uint8_t LED_RGB_BLUE = LED_RGB_BLUE_PIN;
// Buttons
#define BUTTONS_NUMBER 2
@@ -146,12 +146,8 @@ static const uint8_t A5 = PIN_A5 ;
/*
* Serial interfaces
*/
// Serial
#define PIN_SERIAL_RX (10)
#define PIN_SERIAL_TX (9)
#define PIN_SERIAL2_RX (5)
#define PIN_SERIAL2_TX (6)
//#define HAVE_HWSERIAL2 true // TODO: implement UARTE in Uart.cpp
#define PIN_SERIAL1_RX PIN_D9
#define PIN_SERIAL1_TX PIN_D10
/*
* SPI Interfaces
@@ -200,6 +196,7 @@ void pwm_teardown(NRF_PWM_Type* pwm);
void ledWrite(uint32_t led_pin, uint8_t value);
void rgbLedWrite(uint8_t red, uint8_t green, uint8_t blue);
static uint16_t led_duty_cycles[PWM0_CH_NUM] = { 0 };
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
+16 -7
View File
@@ -54,6 +54,14 @@ extern "C"
#define LED_STATE_ON 0 // State when LED is litted
/*
* Buttons
*/
#define PIN_BUTTON1 11
#define PIN_BUTTON2 12
#define PIN_BUTTON3 24
#define PIN_BUTTON4 25
/*
* Analog pins
*/
@@ -86,11 +94,14 @@ static const uint8_t AREF = PIN_AREF;
/*
* Serial interfaces
*/
#define PIN_SERIAL_RX (33)
#define PIN_SERIAL_TX (34)
//#define PIN_SERIAL2_RX (8)
//#define PIN_SERIAL2_TX (6)
// Arduino Header D0, D1
#define PIN_SERIAL1_RX (33) // P1.01
#define PIN_SERIAL1_TX (34) // P1.02
// Connected to Jlink CDC
#define PIN_SERIAL2_RX (8)
#define PIN_SERIAL2_TX (6)
/*
* SPI Interfaces
@@ -124,9 +135,7 @@ static const uint8_t SCK = PIN_SPI_SCK ;
// On-board QSPI Flash
#define EXTERNAL_FLASH_DEVICES MX25R6435F
#define USB_MSC_BLOCK_SIZE 512
#define USB_MSC_BLOCK_COUNT ((8*1024*1024) / USB_MSC_BLOCK_SIZE)
#define EXTERNAL_FLASH_USE_QSPI
#ifdef __cplusplus
}
+44
View File
@@ -0,0 +1,44 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "variant.h"
#include "wiring_constants.h"
#include "wiring_digital.h"
#include "nrf.h"
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D13
45, // D0 is P1.13 (LED1)
43, // D1 is P1.11 (LED2)
15, // D2 is P0.15 (Button)
};
void initVariant()
{
// LED1 & LED2
pinMode(PIN_LED1, OUTPUT);
ledOff(PIN_LED1);
pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);
}
+89
View File
@@ -0,0 +1,89 @@
/*
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
Copyright (c) 2016 Sandeep Mistry All right reserved.
Copyright (c) 2018, Adafruit Industries (adafruit.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_MDBT50Q_RX_
#define _VARIANT_MDBT50Q_RX_
/** Master clock frequency */
#define VARIANT_MCK (64000000ul)
#define USE_LFXO // Board uses 32khz crystal for LF
// define USE_LFRC // Board uses RC for LF
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "WVariant.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
// Number of pins defined in PinDescription array
#define PINS_COUNT (3)
#define NUM_DIGITAL_PINS (3)
#define NUM_ANALOG_INPUTS (0) // A6 is used for battery, A7 is analog reference
#define NUM_ANALOG_OUTPUTS (0)
// LEDs
#define PIN_LED1 (0)
#define PIN_LED2 (1)
#define LED_BUILTIN PIN_LED1
#define LED_CONN PIN_LED2
#define LED_RED PIN_LED1
#define LED_BLUE PIN_LED2
#define LED_STATE_ON 0 // State when LED is litted
/*
* Buttons
*/
#define PIN_BUTTON1 2
#define PIN_DFU 2
// Buttons
/*
#define PIN_BUTTON1 (2)
#define PIN_BUTTON2 (3)
#define PIN_BUTTON3 (4)
#define PIN_BUTTON4 (5)
*/
#define ADC_RESOLUTION 14
// Bad things happen if the serial pins aren't defined. Instead
// define them with an invalid pin number
// Serial
#define PIN_SERIAL1_RX (3)
#define PIN_SERIAL1_TX (3)
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#endif