serial port clean up

This commit is contained in:
hathach committed 2018-09-01 13:40:04 +07:00
1 parent 211e048537
commit 6f8c546595
2 files changed
+21 -20

No files matched your search

+2 -9
View File
@@ -202,19 +202,12 @@ size_t Uart::write(const uint8_t data)
#define NRF_UART0_IRQn UARTE0_UART0_IRQn
#ifdef NRF52840_XXAA
#define SERIAL_HW Serial1
#else
#define SERIAL_HW Serial
#endif
Uart SERIAL_HW( NRF_UART0, NRF_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
Uart SERIAL_PORT_HARDWARE( NRF_UART0, NRF_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
extern "C"
{
void UARTE0_UART0_IRQHandler()
{
SERIAL_HW.IrqHandler();
SERIAL_PORT_HARDWARE.IrqHandler();
}
}
+19 -11
View File
@@ -68,15 +68,6 @@ class Uart : public HardwareSerial
SemaphoreHandle_t _mutex;
};
#ifdef __cplusplus
#ifdef NRF52840_XXAA
extern Uart Serial1;
#else
extern Uart Serial;
#endif
#endif
// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
@@ -93,5 +84,22 @@ 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.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial
#ifdef NRF52840_XXAA
#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
#ifdef __cplusplus
extern Uart SERIAL_PORT_HARDWARE;
#endif