From 8d2fed6ce5244eb80ac4570e68f7436e0caa3815 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 5 Nov 2018 16:45:38 +0700 Subject: [PATCH] update variant bsp for pca10056 --- .../BarometricPressureSensor.ino | 1 - variants/feather_nrf52832/variant.h | 22 +++---- variants/feather_nrf52840_express/variant.cpp | 16 +++-- variants/pca10056/variant.cpp | 15 +++-- variants/pca10056/variant.h | 58 ++++++++----------- 5 files changed, 54 insertions(+), 58 deletions(-) diff --git a/libraries/SPI/examples/BarometricPressureSensor/BarometricPressureSensor.ino b/libraries/SPI/examples/BarometricPressureSensor/BarometricPressureSensor.ino index 31712934..8104fcbc 100755 --- a/libraries/SPI/examples/BarometricPressureSensor/BarometricPressureSensor.ino +++ b/libraries/SPI/examples/BarometricPressureSensor/BarometricPressureSensor.ino @@ -39,7 +39,6 @@ const int chipSelectPin = 7; void setup() { Serial.begin(9600); - while ( !Serial ) delay(10); // for nrf52840 with native usb // start the SPI library: SPI.begin(); diff --git a/variants/feather_nrf52832/variant.h b/variants/feather_nrf52832/variant.h index 068ca81d..8f8f196c 100644 --- a/variants/feather_nrf52832/variant.h +++ b/variants/feather_nrf52832/variant.h @@ -40,24 +40,16 @@ extern "C" #define NUM_ANALOG_OUTPUTS (0u) // LEDs -#define PIN_LED1 (17) -#define PIN_LED2 (19) +#define PIN_LED1 (17) +#define PIN_LED2 (19) -#define LED_BUILTIN PIN_LED1 -#define LED_CONN PIN_LED2 +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 -#define LED_RED PIN_LED1 -#define LED_BLUE 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 (2) -#define PIN_BUTTON2 (3) -#define PIN_BUTTON3 (4) -#define PIN_BUTTON4 (5) -*/ +#define LED_STATE_ON 1 // State when LED is litted /* * Analog pins diff --git a/variants/feather_nrf52840_express/variant.cpp b/variants/feather_nrf52840_express/variant.cpp index a733913d..530378a9 100644 --- a/variants/feather_nrf52840_express/variant.cpp +++ b/variants/feather_nrf52840_express/variant.cpp @@ -27,12 +27,18 @@ const uint32_t g_ADigitalPinMap[] = { - 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , - 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15, - 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23, - 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 -}; + // P0 + 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , + 8 , 9 , 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 +}; void initVariant() { // LED1 & LED2 diff --git a/variants/pca10056/variant.cpp b/variants/pca10056/variant.cpp index 4d8351aa..dde6062c 100644 --- a/variants/pca10056/variant.cpp +++ b/variants/pca10056/variant.cpp @@ -28,10 +28,17 @@ const uint32_t g_ADigitalPinMap[] = { - 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , - 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15, - 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23, - 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 + // P0 + 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , + 8 , 9 , 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + + // P1 + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 }; diff --git a/variants/pca10056/variant.h b/variants/pca10056/variant.h index 9e6499c2..a97aa209 100644 --- a/variants/pca10056/variant.h +++ b/variants/pca10056/variant.h @@ -34,42 +34,34 @@ extern "C" #endif // __cplusplus // Number of pins defined in PinDescription array -#define PINS_COUNT (32u) -#define NUM_DIGITAL_PINS (32u) +#define PINS_COUNT (64) +#define NUM_DIGITAL_PINS (64) #define NUM_ANALOG_INPUTS (8u) #define NUM_ANALOG_OUTPUTS (0u) // LEDs -#define PIN_LED1 (13) -#define PIN_LED2 (14) +#define PIN_LED1 (13) +#define PIN_LED2 (14) -#define LED_BUILTIN PIN_LED1 -#define LED_CONN PIN_LED2 +#define LED_BUILTIN PIN_LED1 +#define LED_CONN PIN_LED2 -#define LED_RED PIN_LED1 -#define LED_BLUE 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_BUTTON2 (3) -#define PIN_BUTTON3 (4) -#define PIN_BUTTON4 (5) -*/ +#define LED_STATE_ON 0 // State when LED is litted /* * Analog pins */ -#define PIN_A0 (2) -#define PIN_A1 (3) -#define PIN_A2 (4) -#define PIN_A3 (5) -#define PIN_A4 (28) -#define PIN_A5 (29) -#define PIN_A6 (30) -#define PIN_A7 (31) +#define PIN_A0 (3) +#define PIN_A1 (4) +#define PIN_A2 (28) +#define PIN_A3 (29) +#define PIN_A4 (30) +#define PIN_A5 (31) +#define PIN_A6 (26) +#define PIN_A7 (27) static const uint8_t A0 = PIN_A0 ; static const uint8_t A1 = PIN_A1 ; @@ -82,8 +74,8 @@ static const uint8_t A7 = PIN_A7 ; #define ADC_RESOLUTION 14 // Other pins -#define PIN_AREF (24) -#define PIN_DFU (20) +#define PIN_AREF (2) +#define PIN_DFU (11) #define PIN_NFC1 (9) #define PIN_NFC2 (10) @@ -100,11 +92,11 @@ static const uint8_t AREF = PIN_AREF; */ #define SPI_INTERFACES_COUNT 1 -#define PIN_SPI_MISO (14) -#define PIN_SPI_MOSI (13) -#define PIN_SPI_SCK (12) +#define PIN_SPI_MISO (47) +#define PIN_SPI_MOSI (46) +#define PIN_SPI_SCK (45) -static const uint8_t SS = 18 ; +static const uint8_t SS = 44 ; static const uint8_t MOSI = PIN_SPI_MOSI ; static const uint8_t MISO = PIN_SPI_MISO ; static const uint8_t SCK = PIN_SPI_SCK ; @@ -114,8 +106,8 @@ static const uint8_t SCK = PIN_SPI_SCK ; */ #define WIRE_INTERFACES_COUNT 1 -#define PIN_WIRE_SDA (25u) -#define PIN_WIRE_SCL (26u) +#define PIN_WIRE_SDA (43) +#define PIN_WIRE_SCL (42) /* * QSPI interface for external flash