remove SERIAL_INTERFACES_COUNT macro

nrf52832 keep PIN_SERIAL_RX/TX
This commit is contained in:
hathach committed 2020-01-31 22:09:46 +07:00
1 parent 923974f6c4
commit a00eb4fa70
10 files changed
+12 -23

No files matched your search

+9 -5
View File
@@ -26,12 +26,12 @@ void serialEventRun(void)
{ {
if (serialEvent && Serial.available() ) serialEvent(); if (serialEvent && Serial.available() ) serialEvent();
#ifndef NRF52832_XXAA // 832 only has 1 UART for Serial #if defined(PIN_SERIAL1_RX) && defined(PIN_SERIAL1_TX)
if (serialEvent1 && Serial1.available() ) serialEvent1(); if (serialEvent1 && Serial1.available() ) serialEvent1();
#endif
#if SERIAL_INTERFACES_COUNT >= 2 #if defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
if (serialEvent2 && Serial2.available() ) serialEvent2(); if (serialEvent2 && Serial2.available() ) serialEvent2();
#endif
#endif #endif
} }
@@ -241,7 +241,11 @@ size_t Uart::write(const uint8_t *buffer, size_t size)
} }
//------------- Serial1 (or Serial in case of nRF52832) -------------// //------------- Serial1 (or Serial in case of nRF52832) -------------//
Uart SERIAL_PORT_HARDWARE( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX ); #ifdef NRF52832_XXAA
Uart Serial( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
#else
Uart Serial1( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL1_RX, PIN_SERIAL1_TX );
#endif
extern "C" extern "C"
{ {
@@ -252,7 +256,7 @@ extern "C"
} }
//------------- Serial2 -------------// //------------- Serial2 -------------//
#if SERIAL_INTERFACES_COUNT >= 2 #if defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
Uart Serial2( NRF_UARTE1, UARTE1_IRQn, PIN_SERIAL2_RX, PIN_SERIAL2_TX ); Uart Serial2( NRF_UARTE1, UARTE1_IRQn, PIN_SERIAL2_RX, PIN_SERIAL2_TX );
extern "C" extern "C"
+1 -1
View File
@@ -104,6 +104,6 @@ class Uart : public HardwareSerial
extern Uart SERIAL_PORT_HARDWARE; extern Uart SERIAL_PORT_HARDWARE;
#if SERIAL_INTERFACES_COUNT >= 2 #if defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
extern Uart Serial2; extern Uart Serial2;
#endif #endif
@@ -91,8 +91,6 @@ static const uint8_t A9 = PIN_A9 ;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1
#define PIN_SERIAL1_RX (0) #define PIN_SERIAL1_RX (0)
#define PIN_SERIAL1_TX (1) #define PIN_SERIAL1_TX (1)
-2
View File
@@ -85,8 +85,6 @@ static const uint8_t A7 = PIN_A7 ;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1
#define PIN_SERIAL1_RX (0) #define PIN_SERIAL1_RX (0)
#define PIN_SERIAL1_TX (1) #define PIN_SERIAL1_TX (1)
+2 -4
View File
@@ -87,10 +87,8 @@ static const uint8_t AREF = PIN_AREF;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1 #define PIN_SERIAL_RX (8)
#define PIN_SERIAL_TX (6)
#define PIN_SERIAL1_RX (8)
#define PIN_SERIAL1_TX (6)
/* /*
* SPI Interfaces * SPI Interfaces
@@ -93,8 +93,6 @@ static const uint8_t AREF = PIN_AREF;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1
#define PIN_SERIAL1_RX (1) #define PIN_SERIAL1_RX (1)
#define PIN_SERIAL1_TX (0) #define PIN_SERIAL1_TX (0)
@@ -89,8 +89,6 @@ static const uint8_t A6 = PIN_A6 ;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1
#define PIN_SERIAL1_RX (0) #define PIN_SERIAL1_RX (0)
#define PIN_SERIAL1_TX (1) #define PIN_SERIAL1_TX (1)
@@ -94,8 +94,6 @@ static const uint8_t AREF = PIN_AREF;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1
#define PIN_SERIAL1_RX (1) #define PIN_SERIAL1_RX (1)
#define PIN_SERIAL1_TX (0) #define PIN_SERIAL1_TX (0)
-2
View File
@@ -146,8 +146,6 @@ static const uint8_t A5 = PIN_A5 ;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 1
#define PIN_SERIAL1_RX PIN_D9 #define PIN_SERIAL1_RX PIN_D9
#define PIN_SERIAL1_TX PIN_D10 #define PIN_SERIAL1_TX PIN_D10
-1
View File
@@ -94,7 +94,6 @@ static const uint8_t AREF = PIN_AREF;
/* /*
* Serial interfaces * Serial interfaces
*/ */
#define SERIAL_INTERFACES_COUNT 2
// Arduino Header D0, D1 // Arduino Header D0, D1
#define PIN_SERIAL1_RX (33) // P1.01 #define PIN_SERIAL1_RX (33) // P1.01