|
| 1 | +#ifndef _SEEED_XIAO_NRF52840_PLUS_H_ |
| 2 | +#define _SEEED_XIAO_NRF52840_PLUS_H_ |
| 3 | + |
| 4 | +/** Master clock frequency */ |
| 5 | +#define VARIANT_MCK (64000000ul) |
| 6 | + |
| 7 | +#define USE_LFXO // Board uses 32khz crystal for LF |
| 8 | +//#define USE_LFRC // Board uses RC for LF |
| 9 | + |
| 10 | +/*---------------------------------------------------------------------------- |
| 11 | + * Headers |
| 12 | + *----------------------------------------------------------------------------*/ |
| 13 | + |
| 14 | +#include "WVariant.h" |
| 15 | + |
| 16 | +#ifdef __cplusplus |
| 17 | +extern "C" |
| 18 | +{ |
| 19 | +#endif // __cplusplus |
| 20 | + |
| 21 | +#define PINS_COUNT (39) |
| 22 | +#define NUM_DIGITAL_PINS (39) |
| 23 | +#define NUM_ANALOG_INPUTS (8) |
| 24 | +#define NUM_ANALOG_OUTPUTS (0) |
| 25 | + |
| 26 | +// LEDs |
| 27 | +#define PIN_LED (LED_RED) |
| 28 | +#define LED_PWR (PINS_COUNT) |
| 29 | +#define PIN_NEOPIXEL (PINS_COUNT) |
| 30 | +#define NEOPIXEL_NUM (0) |
| 31 | + |
| 32 | +#define LED_BUILTIN (PIN_LED) |
| 33 | + |
| 34 | +#define LED_RED (11) |
| 35 | +#define LED_GREEN (13) |
| 36 | +#define LED_BLUE (12) |
| 37 | + |
| 38 | +#define LED_STATE_ON (1) // State when LED is litted |
| 39 | + |
| 40 | +// Buttons |
| 41 | +#define PIN_BUTTON1 (PINS_COUNT) |
| 42 | + |
| 43 | +// Digital PINs |
| 44 | +static const uint8_t D0 = 0 ; |
| 45 | +static const uint8_t D1 = 1 ; |
| 46 | +static const uint8_t D2 = 2 ; |
| 47 | +static const uint8_t D3 = 3 ; |
| 48 | +static const uint8_t D4 = 4 ; |
| 49 | +static const uint8_t D5 = 5 ; |
| 50 | +static const uint8_t D6 = 6 ; |
| 51 | +static const uint8_t D7 = 7 ; |
| 52 | +static const uint8_t D8 = 8 ; |
| 53 | +static const uint8_t D9 = 9 ; |
| 54 | +static const uint8_t D10 = 10; |
| 55 | + |
| 56 | +static const uint8_t D11 = 30; |
| 57 | +static const uint8_t D12 = 31; |
| 58 | +static const uint8_t D13 = 32; |
| 59 | +static const uint8_t D14 = 33; |
| 60 | +static const uint8_t D15 = 34; |
| 61 | +static const uint8_t D16 = 35; |
| 62 | +static const uint8_t D17 = 36; |
| 63 | +static const uint8_t D18 = 37; |
| 64 | +static const uint8_t D19 = 38; |
| 65 | + |
| 66 | +#define VBAT_ENABLE (14) // Output LOW to enable reading of the BAT voltage. |
| 67 | + // https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging |
| 68 | + |
| 69 | +#define PIN_CHARGING_CURRENT (22) // Battery Charging current |
| 70 | + // https://wiki.seeedstudio.com/XIAO_BLE#battery-charging-current |
| 71 | + |
| 72 | +// Analog pins |
| 73 | +#define PIN_A0 (0) |
| 74 | +#define PIN_A1 (1) |
| 75 | +#define PIN_A2 (2) |
| 76 | +#define PIN_A3 (3) |
| 77 | +#define PIN_A4 (4) |
| 78 | +#define PIN_A5 (5) |
| 79 | +#define PIN_VBAT (35) // Read the BAT voltage. |
| 80 | + // https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging |
| 81 | + |
| 82 | +static const uint8_t A0 = PIN_A0; |
| 83 | +static const uint8_t A1 = PIN_A1; |
| 84 | +static const uint8_t A2 = PIN_A2; |
| 85 | +static const uint8_t A3 = PIN_A3; |
| 86 | +static const uint8_t A4 = PIN_A4; |
| 87 | +static const uint8_t A5 = PIN_A5; |
| 88 | +static const uint8_t ADC_BAT = PIN_VBAT; |
| 89 | + |
| 90 | +#define ADC_RESOLUTION (12) |
| 91 | + |
| 92 | +// Other pins |
| 93 | +#define PIN_NFC1 (33) |
| 94 | +#define PIN_NFC2 (34) |
| 95 | + |
| 96 | +// Serial interfaces |
| 97 | +#define PIN_SERIAL1_RX (7) |
| 98 | +#define PIN_SERIAL1_TX (6) |
| 99 | + |
| 100 | +static const uint8_t RX = PIN_SERIAL1_RX; |
| 101 | +static const uint8_t TX = PIN_SERIAL1_TX; |
| 102 | + |
| 103 | +#define PIN_SERIAL2_RX (33) |
| 104 | +#define PIN_SERIAL2_TX (34) |
| 105 | + |
| 106 | +static const uint8_t RX1 = PIN_SERIAL2_RX; |
| 107 | +static const uint8_t TX1 = PIN_SERIAL2_TX; |
| 108 | + |
| 109 | +// SPI Interfaces |
| 110 | +#define SPI_INTERFACES_COUNT (2) |
| 111 | + |
| 112 | +#define PIN_SPI_MISO (9) |
| 113 | +#define PIN_SPI_MOSI (10) |
| 114 | +#define PIN_SPI_SCK (8) |
| 115 | + |
| 116 | +static const uint8_t SS = 7; |
| 117 | +static const uint8_t MOSI = PIN_SPI_MOSI; |
| 118 | +static const uint8_t MISO = PIN_SPI_MISO; |
| 119 | +static const uint8_t SCK = PIN_SPI_SCK ; |
| 120 | + |
| 121 | +#define PIN_SPI1_MISO (37) |
| 122 | +#define PIN_SPI1_MOSI (36) |
| 123 | +#define PIN_SPI1_SCK (38) |
| 124 | + |
| 125 | +static const uint8_t MOSI1 = PIN_SPI1_MOSI; |
| 126 | +static const uint8_t MISO1 = PIN_SPI1_MISO; |
| 127 | +static const uint8_t SCK1 = PIN_SPI1_SCK ; |
| 128 | + |
| 129 | +// Wire Interfaces |
| 130 | +#define WIRE_INTERFACES_COUNT (2) |
| 131 | + |
| 132 | +#define PIN_WIRE_SDA (4) |
| 133 | +#define PIN_WIRE_SCL (5) |
| 134 | + |
| 135 | +static const uint8_t SDA = PIN_WIRE_SDA; |
| 136 | +static const uint8_t SCL = PIN_WIRE_SCL; |
| 137 | + |
| 138 | +#define PIN_WIRE1_SDA (17) |
| 139 | +#define PIN_WIRE1_SCL (16) |
| 140 | +#define PIN_LSM6DS3TR_C_POWER (15) |
| 141 | +#define PIN_LSM6DS3TR_C_INT1 (18) |
| 142 | + |
| 143 | +// i2s Interfaces |
| 144 | +#define PIN_I2S_SCK (31) |
| 145 | +#define PIN_I2S_SD (30) |
| 146 | +#define PIN_I2S_WS (32) |
| 147 | + |
| 148 | +static const uint8_t I2S_SCK = PIN_I2S_SCK; |
| 149 | +static const uint8_t I2S_SD = PIN_I2S_SD ; |
| 150 | +static const uint8_t I2S_WS = PIN_I2S_WS ; |
| 151 | + |
| 152 | +// PDM Interfaces |
| 153 | +#define PIN_PDM_PWR (19) |
| 154 | +#define PIN_PDM_CLK (20) |
| 155 | +#define PIN_PDM_DIN (21) |
| 156 | + |
| 157 | +// QSPI Pins |
| 158 | +#define PIN_QSPI_SCK (24) |
| 159 | +#define PIN_QSPI_CS (25) |
| 160 | +#define PIN_QSPI_IO0 (26) |
| 161 | +#define PIN_QSPI_IO1 (27) |
| 162 | +#define PIN_QSPI_IO2 (28) |
| 163 | +#define PIN_QSPI_IO3 (29) |
| 164 | + |
| 165 | +// On-board QSPI Flash |
| 166 | +#define EXTERNAL_FLASH_DEVICES (P25Q16H) |
| 167 | +#define EXTERNAL_FLASH_USE_QSPI |
| 168 | + |
| 169 | +#ifdef __cplusplus |
| 170 | +} |
| 171 | +#endif |
| 172 | + |
| 173 | +/*---------------------------------------------------------------------------- |
| 174 | + * Arduino objects - C++ only |
| 175 | + *----------------------------------------------------------------------------*/ |
| 176 | + |
| 177 | +#endif |
0 commit comments