Skip to content

Commit a00eb4f

Browse files
committed
remove SERIAL_INTERFACES_COUNT macro
nrf52832 keep PIN_SERIAL_RX/TX
1 parent 923974f commit a00eb4f

File tree

10 files changed

+12
-23
lines changed

10 files changed

+12
-23
lines changed

cores/nRF5/Uart.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ void serialEventRun(void)
2626
{
2727
if (serialEvent && Serial.available() ) serialEvent();
2828

29-
#ifndef NRF52832_XXAA // 832 only has 1 UART for Serial
29+
#if defined(PIN_SERIAL1_RX) && defined(PIN_SERIAL1_TX)
3030
if (serialEvent1 && Serial1.available() ) serialEvent1();
31+
#endif
3132

32-
#if SERIAL_INTERFACES_COUNT >= 2
33+
#if defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
3334
if (serialEvent2 && Serial2.available() ) serialEvent2();
34-
#endif
3535
#endif
3636
}
3737

@@ -241,7 +241,11 @@ size_t Uart::write(const uint8_t *buffer, size_t size)
241241
}
242242

243243
//------------- Serial1 (or Serial in case of nRF52832) -------------//
244-
Uart SERIAL_PORT_HARDWARE( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
244+
#ifdef NRF52832_XXAA
245+
Uart Serial( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
246+
#else
247+
Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
248+
#endif
245249

246250
extern "C"
247251
{
@@ -252,7 +256,7 @@ extern "C"
252256
}
253257

254258
//------------- Serial2 -------------//
255-
#if SERIAL_INTERFACES_COUNT >= 2
259+
#if defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
256260
Uart Serial2( NRF_UARTE1, UARTE1_IRQn, PIN_SERIAL2_RX, PIN_SERIAL2_TX );
257261

258262
extern "C"

cores/nRF5/Uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ class Uart : public HardwareSerial
104104

105105
extern Uart SERIAL_PORT_HARDWARE;
106106

107-
#if SERIAL_INTERFACES_COUNT >= 2
107+
#if defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
108108
extern Uart Serial2;
109109
#endif

variants/circuitplayground_nrf52840/variant.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ static const uint8_t A9 = PIN_A9 ;
9191
/*
9292
* Serial interfaces
9393
*/
94-
#define SERIAL_INTERFACES_COUNT 1
95-
9694
#define PIN_SERIAL1_RX (0)
9795
#define PIN_SERIAL1_TX (1)
9896

variants/clue_nrf52840/variant.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ static const uint8_t A7 = PIN_A7 ;
8585
/*
8686
* Serial interfaces
8787
*/
88-
#define SERIAL_INTERFACES_COUNT 1
89-
9088
#define PIN_SERIAL1_RX (0)
9189
#define PIN_SERIAL1_TX (1)
9290

variants/feather_nrf52832/variant.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ static const uint8_t AREF = PIN_AREF;
8787
/*
8888
* Serial interfaces
8989
*/
90-
#define SERIAL_INTERFACES_COUNT 1
91-
92-
#define PIN_SERIAL1_RX (8)
93-
#define PIN_SERIAL1_TX (6)
90+
#define PIN_SERIAL_RX (8)
91+
#define PIN_SERIAL_TX (6)
9492

9593
/*
9694
* SPI Interfaces

variants/feather_nrf52840_express/variant.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ static const uint8_t AREF = PIN_AREF;
9393
/*
9494
* Serial interfaces
9595
*/
96-
#define SERIAL_INTERFACES_COUNT 1
97-
9896
#define PIN_SERIAL1_RX (1)
9997
#define PIN_SERIAL1_TX (0)
10098

variants/itsybitsy_nrf52840_express/variant.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ static const uint8_t A6 = PIN_A6 ;
8989
/*
9090
* Serial interfaces
9191
*/
92-
#define SERIAL_INTERFACES_COUNT 1
93-
9492
#define PIN_SERIAL1_RX (0)
9593
#define PIN_SERIAL1_TX (1)
9694

variants/metro_nrf52840_express/variant.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ static const uint8_t AREF = PIN_AREF;
9494
/*
9595
* Serial interfaces
9696
*/
97-
#define SERIAL_INTERFACES_COUNT 1
98-
9997
#define PIN_SERIAL1_RX (1)
10098
#define PIN_SERIAL1_TX (0)
10199

variants/particle_xenon/variant.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ static const uint8_t A5 = PIN_A5 ;
146146
/*
147147
* Serial interfaces
148148
*/
149-
#define SERIAL_INTERFACES_COUNT 1
150-
151149
#define PIN_SERIAL1_RX PIN_D9
152150
#define PIN_SERIAL1_TX PIN_D10
153151

variants/pca10056/variant.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ static const uint8_t AREF = PIN_AREF;
9494
/*
9595
* Serial interfaces
9696
*/
97-
#define SERIAL_INTERFACES_COUNT 2
9897

9998
// Arduino Header D0, D1
10099
#define PIN_SERIAL1_RX (33) // P1.01

0 commit comments

Comments
 (0)