support SerialEvent1/2
This commit is contained in:
1 parent
306b10dc7f
commit
923974f6c4
3 files changed
+19
-4
No files matched your search
@@ -77,4 +77,9 @@ class HardwareSerial : public Stream
|
||||
extern void serialEventRun(void) __attribute__((weak));
|
||||
extern void serialEvent() __attribute__((weak));
|
||||
|
||||
#ifndef NRF52832_XXAA // 832 only has 1 UART for Serial
|
||||
extern void serialEvent1() __attribute__((weak));
|
||||
extern void serialEvent2() __attribute__((weak));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -25,6 +25,14 @@
|
||||
void serialEventRun(void)
|
||||
{
|
||||
if (serialEvent && Serial.available() ) serialEvent();
|
||||
|
||||
#ifndef NRF52832_XXAA // 832 only has 1 UART for Serial
|
||||
if (serialEvent1 && Serial1.available() ) serialEvent1();
|
||||
|
||||
#if SERIAL_INTERFACES_COUNT >= 2
|
||||
if (serialEvent2 && Serial2.available() ) serialEvent2();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Uart::Uart(NRF_UARTE_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pinTX)
|
||||
|
||||
+6
-4
@@ -89,15 +89,17 @@ class Uart : public HardwareSerial
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
||||
// pins are NOT connected to anything by default.
|
||||
#ifdef NRF52840_XXAA
|
||||
#ifdef NRF52832_XXAA
|
||||
#define SERIAL_PORT_MONITOR Serial
|
||||
#define SERIAL_PORT_HARDWARE Serial
|
||||
|
||||
#else
|
||||
#define SERIAL_PORT_MONITOR Serial
|
||||
#define SERIAL_PORT_USBVIRTUAL Serial
|
||||
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
#else
|
||||
#define SERIAL_PORT_MONITOR Serial
|
||||
#define SERIAL_PORT_HARDWARE Serial
|
||||
|
||||
#endif
|
||||
|
||||
extern Uart SERIAL_PORT_HARDWARE;
|
||||
|
||||
Reference in new issue
Block a user