Clean up pins in variant.h
This commit is contained in:
@@ -6,44 +6,44 @@ const uint32_t g_ADigitalPinMap[PINS_COUNT + 1] =
|
|||||||
{
|
{
|
||||||
0, // P0.00
|
0, // P0.00
|
||||||
1, // P0.01
|
1, // P0.01
|
||||||
2, // P0.02, AIN0 BATTERY_PIN
|
2, // P0.02
|
||||||
3, // P0.03
|
3, // P0.03
|
||||||
4, // P0.04, SENSOR_EN
|
4, // P0.04
|
||||||
5, // P0.05, EXT_PWR_DETEC
|
5, // P0.05
|
||||||
6, // P0.06, PIN_BUTTON1
|
6, // P0.06
|
||||||
7, // P0.07, LORA_BUSY
|
7, // P0.07
|
||||||
8, // P0.08, GPS_VRTC_EN
|
8, // P0.08
|
||||||
9, // P0.09
|
9, // P0.09
|
||||||
10, // P0.10
|
10, // P0.10
|
||||||
11, // P0.11, PIN_SPI_SCK
|
11, // P0.11
|
||||||
12, // P0.12, PIN_SPI_NSS
|
12, // P0.12
|
||||||
13, // P0.13, PIN_SERIAL1_TX
|
13, // P0.13, PIN_SERIAL1_TX
|
||||||
14, // P0.14, PIN_SERIAL1_RX
|
14, // P0.14, PIN_SERIAL1_RX
|
||||||
15, // P0.15, GPS_RTC_INT
|
15, // P0.15, PIN_SERIAL2_RX
|
||||||
16, // P0.16, PIN_SERIAL2_TX
|
16, // P0.16, PIN_WIRE_SCL
|
||||||
17, // P0.17, PIN_SERIAL2_RX
|
17, // P0.17, PIN_SERIAL2_TX
|
||||||
18, // P0.18
|
18, // P0.18
|
||||||
19, // P0.19
|
19, // P0.19
|
||||||
20, // P0.20
|
20, // P0.20
|
||||||
21, // P0.21
|
21, // P0.21, PIN_WIRE_SDA
|
||||||
22, // P0.22
|
22, // P0.22
|
||||||
23, // P0.23
|
23, // P0.23
|
||||||
24, // P0.24, LED_GREEN
|
24, // P0.24,
|
||||||
25, // P0.25, BUZZER_PIN
|
25, // P0.25,
|
||||||
26, // P0.26, PIN_WIRE_SDA
|
26, // P0.26,
|
||||||
27, // P0.27, PIN_WIRE_SCL
|
27, // P0.27,
|
||||||
28, // P0.28
|
28, // P0.28
|
||||||
29, // P0.29, AIN5, LUX_SENSOR
|
29, // P0.29,
|
||||||
30, // P0.30
|
30, // P0.30
|
||||||
31, // P0.31, AIN7, TEMP_SENSOR
|
31, // P0.31,
|
||||||
32, // P1.00
|
32, // P1.00
|
||||||
33, // P1.01, LORA_DIO_1
|
33, // P1.01, LORA_DIO_1
|
||||||
34, // P1.02
|
34, // P1.02
|
||||||
35, // P1.03, EXT_CHRG_DETECT
|
35, // P1.03,
|
||||||
36, // P1.04
|
36, // P1.04
|
||||||
37, // P1.05, LR1110_EN
|
37, // P1.05, LR1110_EN
|
||||||
38, // P1.06, 3V3_EN PWR TO SENSORS
|
38, // P1.06,
|
||||||
39, // P1.07, PIN_3V3_ACC_EN
|
39, // P1.07,
|
||||||
40, // P1.08, PIN_SPI_MISO
|
40, // P1.08, PIN_SPI_MISO
|
||||||
41, // P1.09, PIN_SPI_MOSI
|
41, // P1.09, PIN_SPI_MOSI
|
||||||
42, // P1.10, LORA_RESET
|
42, // P1.10, LORA_RESET
|
||||||
@@ -57,36 +57,14 @@ const uint32_t g_ADigitalPinMap[PINS_COUNT + 1] =
|
|||||||
|
|
||||||
void initVariant()
|
void initVariant()
|
||||||
{
|
{
|
||||||
// All pins output HIGH by default.
|
|
||||||
// https://github.com/Seeed-Studio/Adafruit_nRF52_Arduino/blob/fab7d30a997a1dfeef9d1d59bfb549adda73815a/cores/nRF5/wiring.c#L65-L69
|
|
||||||
|
|
||||||
pinMode(BATTERY_PIN, INPUT);
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
pinMode(EXT_CHRG_DETECT, INPUT);
|
|
||||||
pinMode(EXT_PWR_DETECT, INPUT);
|
|
||||||
// pinMode(GPS_RESETB, INPUT);
|
|
||||||
pinMode(PIN_BUTTON1, INPUT);
|
pinMode(PIN_BUTTON1, INPUT);
|
||||||
|
|
||||||
pinMode(PIN_3V3_EN, OUTPUT);
|
pinMode(PIN_3V3_EN, OUTPUT);
|
||||||
pinMode(PIN_3V3_ACC_EN, OUTPUT);
|
pinMode(PIN_3V3_ACC_EN, OUTPUT);
|
||||||
// pinMode(BUZZER_EN, OUTPUT);
|
|
||||||
// pinMode(SENSOR_EN, OUTPUT);
|
|
||||||
// pinMode(GPS_EN, OUTPUT);
|
|
||||||
// pinMode(GPS_RESET, OUTPUT);
|
|
||||||
// pinMode(GPS_VRTC_EN, OUTPUT);
|
|
||||||
// pinMode(GPS_SLEEP_INT, OUTPUT);
|
|
||||||
// pinMode(GPS_RTC_INT, OUTPUT);
|
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
pinMode(P_LORA_TX_LED, OUTPUT);
|
pinMode(P_LORA_TX_LED, OUTPUT);
|
||||||
|
|
||||||
// digitalWrite(PIN_3V3_EN, LOW);
|
|
||||||
// digitalWrite(PIN_3V3_ACC_EN, LOW);
|
|
||||||
// digitalWrite(BUZZER_EN, LOW);
|
|
||||||
// digitalWrite(SENSOR_EN, LOW);
|
|
||||||
// digitalWrite(GPS_EN, LOW);
|
|
||||||
// digitalWrite(GPS_RESET, LOW);
|
|
||||||
// digitalWrite(GPS_VRTC_EN, LOW);
|
|
||||||
// digitalWrite(GPS_SLEEP_INT, HIGH);
|
|
||||||
// digitalWrite(GPS_RTC_INT, LOW);
|
|
||||||
digitalWrite(LED_PIN, HIGH);
|
digitalWrite(LED_PIN, HIGH);
|
||||||
digitalWrite(P_LORA_TX_LED, LOW);
|
digitalWrite(P_LORA_TX_LED, LOW);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,7 @@
|
|||||||
#define VARIANT_MCK (64000000ul)
|
#define VARIANT_MCK (64000000ul)
|
||||||
// #define USE_LFRC // 32.768 kHz RC oscillator
|
// #define USE_LFRC // 32.768 kHz RC oscillator
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Power
|
// Power
|
||||||
|
|
||||||
#define NRF_APM // detect usb power
|
|
||||||
#define PIN_3V3_EN (32 + 5) // P1.6 Power to Sensors
|
#define PIN_3V3_EN (32 + 5) // P1.6 Power to Sensors
|
||||||
#define PIN_3V3_ACC_EN -1
|
#define PIN_3V3_ACC_EN -1
|
||||||
|
|
||||||
@@ -20,46 +17,33 @@
|
|||||||
#define BATTERY_IMMUTABLE
|
#define BATTERY_IMMUTABLE
|
||||||
#define ADC_MULTIPLIER (2.0F)
|
#define ADC_MULTIPLIER (2.0F)
|
||||||
|
|
||||||
#define EXT_CHRG_DETECT (-1) // P1.3
|
|
||||||
#define EXT_PWR_DETECT (-1) // P0.5
|
|
||||||
|
|
||||||
#define ADC_RESOLUTION (14)
|
#define ADC_RESOLUTION (14)
|
||||||
#define BATTERY_SENSE_RES (12)
|
#define BATTERY_SENSE_RES (12)
|
||||||
|
|
||||||
#define AREF_VOLTAGE (3.0)
|
#define AREF_VOLTAGE (3.0)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Number of pins
|
// Number of pins
|
||||||
|
|
||||||
#define PINS_COUNT (48)
|
#define PINS_COUNT (48)
|
||||||
#define NUM_DIGITAL_PINS (48)
|
#define NUM_DIGITAL_PINS (48)
|
||||||
#define NUM_ANALOG_INPUTS (6)
|
#define NUM_ANALOG_INPUTS (6)
|
||||||
#define NUM_ANALOG_OUTPUTS (0)
|
#define NUM_ANALOG_OUTPUTS (0)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// UART pin definition
|
// UART pin definition
|
||||||
|
#define PIN_SERIAL1_RX (14) // P0.14
|
||||||
|
#define PIN_SERIAL1_TX (13) // P0.13
|
||||||
|
|
||||||
#define PIN_SERIAL1_RX (14) // P0.14 - checked
|
#define PIN_SERIAL2_RX (15) // P0.15
|
||||||
#define PIN_SERIAL1_TX (13) // P0.13 - checked
|
#define PIN_SERIAL2_TX (17) // P0.17
|
||||||
|
|
||||||
#define PIN_SERIAL2_RX (17) // P0.17 - checked
|
|
||||||
#define PIN_SERIAL2_TX (16) // P0.16 - checked
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// I2C pin definition
|
// I2C pin definition
|
||||||
|
#define HAS_WIRE (1)
|
||||||
|
#define WIRE_INTERFACES_COUNT (1)
|
||||||
|
|
||||||
#define HAS_WIRE (1) // checked
|
#define PIN_WIRE_SDA (21) // P0.21
|
||||||
#define WIRE_INTERFACES_COUNT (1) // checked
|
#define PIN_WIRE_SCL (16) // P0.16
|
||||||
|
|
||||||
#define PIN_WIRE_SDA (15) // P0.26 - checked
|
|
||||||
#define PIN_WIRE_SCL (17) // P0.27 - checked
|
|
||||||
#define I2C_NO_RESCAN
|
#define I2C_NO_RESCAN
|
||||||
// #define HAS_QMA6100P
|
|
||||||
// #define QMA_6100P_INT_PIN (-1) // P1.2
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// SPI pin definition
|
// SPI pin definition
|
||||||
|
|
||||||
#define SPI_INTERFACES_COUNT (1)
|
#define SPI_INTERFACES_COUNT (1)
|
||||||
|
|
||||||
#define PIN_SPI_MISO (0 + 29) // P0.29
|
#define PIN_SPI_MISO (0 + 29) // P0.29
|
||||||
@@ -67,9 +51,7 @@
|
|||||||
#define PIN_SPI_SCK (32 + 15) // P1.15
|
#define PIN_SPI_SCK (32 + 15) // P1.15
|
||||||
#define PIN_SPI_NSS (32 + 13) // P1.13
|
#define PIN_SPI_NSS (32 + 13) // P1.13
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Builtin LEDs
|
// Builtin LEDs
|
||||||
|
|
||||||
#define LED_BUILTIN (-1)
|
#define LED_BUILTIN (-1)
|
||||||
#define LED_RED (32 + 5) // P1.5
|
#define LED_RED (32 + 5) // P1.5
|
||||||
#define LED_BLUE (32 + 7) // P1.7
|
#define LED_BLUE (32 + 7) // P1.7
|
||||||
@@ -78,15 +60,12 @@
|
|||||||
|
|
||||||
#define LED_STATE_ON HIGH
|
#define LED_STATE_ON HIGH
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Builtin buttons
|
// Builtin buttons
|
||||||
|
|
||||||
#define PIN_BUTTON1 (0 + 27) // P0.6
|
#define PIN_BUTTON1 (0 + 27) // P0.6
|
||||||
#define BUTTON_PIN PIN_BUTTON1
|
#define BUTTON_PIN PIN_BUTTON1
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// LR1110
|
// LR1110
|
||||||
|
|
||||||
#define LORA_DIO_1 (32 + 12) // P1.12
|
#define LORA_DIO_1 (32 + 12) // P1.12
|
||||||
#define LORA_DIO_2 (32 + 10) // P1.10
|
#define LORA_DIO_2 (32 + 10) // P1.10
|
||||||
#define LORA_NSS (PIN_SPI_NSS) // P1.13
|
#define LORA_NSS (PIN_SPI_NSS) // P1.13
|
||||||
@@ -107,10 +86,9 @@
|
|||||||
#define LR1110_SPI_SCK_PIN LORA_SCLK
|
#define LR1110_SPI_SCK_PIN LORA_SCLK
|
||||||
#define LR1110_SPI_MOSI_PIN LORA_MOSI
|
#define LR1110_SPI_MOSI_PIN LORA_MOSI
|
||||||
#define LR1110_SPI_MISO_PIN LORA_MISO
|
#define LR1110_SPI_MISO_PIN LORA_MISO
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// GPS
|
|
||||||
|
|
||||||
//#define HAS_GPS 0
|
// GPS
|
||||||
|
#define HAS_GPS 0
|
||||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||||
|
|
||||||
@@ -121,21 +99,3 @@
|
|||||||
#define GPS_SLEEP_INT (-1) // P1.12
|
#define GPS_SLEEP_INT (-1) // P1.12
|
||||||
#define GPS_RTC_INT (-1) // P0.15
|
#define GPS_RTC_INT (-1) // P0.15
|
||||||
#define GPS_RESETB (-1) // P1.14
|
#define GPS_RESETB (-1) // P1.14
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Temp+Lux Sensor
|
|
||||||
|
|
||||||
#define SENSOR_EN (-1) // P0.4
|
|
||||||
#define TEMP_SENSOR (-1) // P0.31/AIN7
|
|
||||||
#define LUX_SENSOR (-1) // P0.29/AIN5
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Accelerometer (I2C addr : ??? )
|
|
||||||
|
|
||||||
#define PIN_3V3_ACC_EN (-1) // P1.7
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Buzzer
|
|
||||||
|
|
||||||
#define BUZZER_EN (-1) // P1.5
|
|
||||||
#define BUZZER_PIN (0 + 25) // P0.25
|
|
||||||
Reference in New Issue
Block a user