|
1 | 1 | #include "variant.h" |
| 2 | + |
| 3 | +#include "nrf.h" |
2 | 4 | #include "wiring_constants.h" |
3 | 5 | #include "wiring_digital.h" |
4 | | -#include "nrf.h" |
5 | 6 |
|
6 | | -const uint32_t g_ADigitalPinMap[] = |
7 | | -{ |
8 | | - // D0 .. D10 |
9 | | - 2, // D0 is P0.02 (A0) |
10 | | - 3, // D1 is P0.03 (A1) |
11 | | - 28, // D2 is P0.28 (A2) |
12 | | - 29, // D3 is P0.29 (A3) |
13 | | - 4, // D4 is P0.04 (A4,SDA) |
14 | | - 5, // D5 is P0.05 (A5,SCL) |
15 | | - 43, // D6 is P1.11 (TX) |
16 | | - 44, // D7 is P1.12 (RX) |
17 | | - 45, // D8 is P1.13 (SCK) |
18 | | - 46, // D9 is P1.14 (MISO) |
19 | | - 47, // D10 is P1.15 (MOSI) |
| 7 | +const uint32_t g_ADigitalPinMap[] = { |
| 8 | + // D0 .. D10 |
| 9 | + 2, // D0 is P0.02 (A0) |
| 10 | + 3, // D1 is P0.03 (A1) |
| 11 | + 28, // D2 is P0.28 (A2) |
| 12 | + 29, // D3 is P0.29 (A3) |
| 13 | + 4, // D4 is P0.04 (A4,SDA) |
| 14 | + 5, // D5 is P0.05 (A5,SCL) |
| 15 | + 43, // D6 is P1.11 (TX) |
| 16 | + 44, // D7 is P1.12 (RX) |
| 17 | + 45, // D8 is P1.13 (SCK) |
| 18 | + 46, // D9 is P1.14 (MISO) |
| 19 | + 47, // D10 is P1.15 (MOSI) |
20 | 20 |
|
21 | | - // LEDs |
22 | | - 26, // D11 is P0.26 (LED RED) |
23 | | - 6, // D12 is P0.06 (LED BLUE) |
24 | | - 30, // D13 is P0.30 (LED GREEN) |
25 | | - 14, // D14 is P0.14 (READ_BAT) |
| 21 | + // LEDs |
| 22 | + 26, // D11 is P0.26 (LED RED) |
| 23 | + 6, // D12 is P0.06 (LED BLUE) |
| 24 | + 30, // D13 is P0.30 (LED GREEN) |
| 25 | + 14, // D14 is P0.14 (READ_BAT) |
26 | 26 |
|
27 | | - // LSM6DS3TR |
28 | | - 40, // D15 is P1.08 (6D_PWR) |
29 | | - 27, // D16 is P0.27 (6D_I2C_SCL) |
30 | | - 7, // D17 is P0.07 (6D_I2C_SDA) |
31 | | - 11, // D18 is P0.11 (6D_INT1) |
| 27 | + // LSM6DS3TR |
| 28 | + 40, // D15 is P1.08 (6D_PWR) |
| 29 | + 27, // D16 is P0.27 (6D_I2C_SCL) |
| 30 | + 7, // D17 is P0.07 (6D_I2C_SDA) |
| 31 | + 11, // D18 is P0.11 (6D_INT1) |
32 | 32 |
|
33 | | - // MIC |
34 | | - 42, // D19 is P1.10 (MIC_PWR) |
35 | | - 32, // D20 is P1.00 (PDM_CLK) |
36 | | - 16, // D21 is P0.16 (PDM_DATA) |
| 33 | + // MIC |
| 34 | + 42, // D19 is P1.10 (MIC_PWR) |
| 35 | + 32, // D20 is P1.00 (PDM_CLK) |
| 36 | + 16, // D21 is P0.16 (PDM_DATA) |
37 | 37 |
|
38 | | - // BQ25100 |
39 | | - 13, // D22 is P0.13 (HICHG) |
40 | | - 17, // D23 is P0.17 (~CHG) |
| 38 | + // BQ25100 |
| 39 | + 13, // D22 is P0.13 (HICHG) |
| 40 | + 17, // D23 is P0.17 (~CHG) |
41 | 41 |
|
42 | | - // |
43 | | - 21, // D24 is P0.21 (QSPI_SCK) |
44 | | - 25, // D25 is P0.25 (QSPI_CSN) |
45 | | - 20, // D26 is P0.20 (QSPI_SIO_0 DI) |
46 | | - 24, // D27 is P0.24 (QSPI_SIO_1 DO) |
47 | | - 22, // D28 is P0.22 (QSPI_SIO_2 WP) |
48 | | - 23, // D29 is P0.23 (QSPI_SIO_3 HOLD) |
| 42 | + // |
| 43 | + 21, // D24 is P0.21 (QSPI_SCK) |
| 44 | + 25, // D25 is P0.25 (QSPI_CSN) |
| 45 | + 20, // D26 is P0.20 (QSPI_SIO_0 DI) |
| 46 | + 24, // D27 is P0.24 (QSPI_SIO_1 DO) |
| 47 | + 22, // D28 is P0.22 (QSPI_SIO_2 WP) |
| 48 | + 23, // D29 is P0.23 (QSPI_SIO_3 HOLD) |
49 | 49 |
|
50 | | - // NFC |
51 | | - 9, // D30 is P0.09 (NFC1) |
52 | | - 10, // D31 is P0.10 (NFC2) |
| 50 | + // NFC |
| 51 | + 9, // D30 is P0.09 (NFC1) |
| 52 | + 10, // D31 is P0.10 (NFC2) |
53 | 53 |
|
54 | | - // VBAT |
55 | | - 31, // D32 is P0.31 (VBAT) |
| 54 | + // VBAT |
| 55 | + 31, // D32 is P0.31 (VBAT) |
56 | 56 | }; |
57 | 57 |
|
58 | | -void initVariant() |
59 | | -{ |
60 | | - // Disable reading of the BAT voltage. |
61 | | - // https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging |
62 | | - pinMode(VBAT_ENABLE, OUTPUT); |
63 | | - //digitalWrite(VBAT_ENABLE, HIGH); |
64 | | - // This was taken from Seeed github butis not coherent with the doc, |
65 | | - // VBAT_ENABLE should be kept to LOW to protect P0.14, (1500/500)*(4.2-3.3)+3.3 = 3.9V > 3.6V |
66 | | - // This induces a 3mA current in the resistors :( but it's better than burning the nrf |
67 | | - digitalWrite(VBAT_ENABLE, LOW); |
| 58 | +void initVariant() { |
| 59 | + // Disable reading of the BAT voltage. |
| 60 | + // https://wiki.seeedstudio.com/XIAO_BLE#q3-what-are-the-considerations-when-using-xiao-nrf52840-sense-for-battery-charging |
| 61 | + pinMode(VBAT_ENABLE, OUTPUT); |
| 62 | + // digitalWrite(VBAT_ENABLE, HIGH); |
| 63 | + // This was taken from Seeed github butis not coherent with the doc, |
| 64 | + // VBAT_ENABLE should be kept to LOW to protect P0.14, (1500/500)*(4.2-3.3)+3.3 = 3.9V > 3.6V |
| 65 | + // This induces a 3mA current in the resistors :( but it's better than burning the nrf |
| 66 | + digitalWrite(VBAT_ENABLE, LOW); |
68 | 67 |
|
69 | | - // Low charging current (50mA) |
70 | | - // https://wiki.seeedstudio.com/XIAO_BLE#battery-charging-current |
71 | | - //pinMode(PIN_CHARGING_CURRENT, INPUT); |
| 68 | + // Low charging current (50mA) |
| 69 | + // https://wiki.seeedstudio.com/XIAO_BLE#battery-charging-current |
| 70 | + // pinMode(PIN_CHARGING_CURRENT, INPUT); |
72 | 71 |
|
73 | | - // High charging current (100mA) |
74 | | - pinMode(PIN_CHARGING_CURRENT, OUTPUT); |
75 | | - digitalWrite(PIN_CHARGING_CURRENT, LOW); |
| 72 | + // High charging current (100mA) |
| 73 | + pinMode(PIN_CHARGING_CURRENT, OUTPUT); |
| 74 | + digitalWrite(PIN_CHARGING_CURRENT, LOW); |
76 | 75 |
|
77 | | - pinMode(PIN_QSPI_CS, OUTPUT); |
78 | | - digitalWrite(PIN_QSPI_CS, HIGH); |
| 76 | + pinMode(PIN_QSPI_CS, OUTPUT); |
| 77 | + digitalWrite(PIN_QSPI_CS, HIGH); |
79 | 78 |
|
80 | | - pinMode(LED_RED, OUTPUT); |
81 | | - digitalWrite(LED_RED, HIGH); |
82 | | - pinMode(LED_GREEN, OUTPUT); |
83 | | - digitalWrite(LED_GREEN, HIGH); |
84 | | - pinMode(LED_BLUE, OUTPUT); |
85 | | - digitalWrite(LED_BLUE, HIGH); |
| 79 | + pinMode(LED_RED, OUTPUT); |
| 80 | + digitalWrite(LED_RED, HIGH); |
| 81 | + pinMode(LED_GREEN, OUTPUT); |
| 82 | + digitalWrite(LED_GREEN, HIGH); |
| 83 | + pinMode(LED_BLUE, OUTPUT); |
| 84 | + digitalWrite(LED_BLUE, HIGH); |
86 | 85 | } |
0 commit comments