add Uart.setPins() to remap Serial rx, tx

This commit is contained in:
hathach committed 2017-07-28 12:28:22 +07:00
1 parent a0419adcd9
commit 9c99fe9c03
2 files changed
+8 -2

No files matched your search

+6 -2
View File
@@ -30,7 +30,6 @@ Uart::Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pi
uc_hwFlow = 0;
_mutex = NULL;
_begun = false;
}
@@ -45,10 +44,15 @@ Uart::Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pi
uc_hwFlow = 1;
_mutex = NULL;
_begun = false;
}
void Uart::setPins(uint8_t pin_rx, uint8_t pin_tx)
{
uc_pinRX = pin_rx;
uc_pinTX = pin_tx;
}
void Uart::begin(unsigned long baudrate)
{
begin(baudrate, (uint8_t)SERIAL_8N1);
+2
View File
@@ -32,6 +32,8 @@ class Uart : public HardwareSerial
public:
Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pinTX);
Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pinTX, uint8_t _pinCTS, uint8_t _pinRTS );
void setPins(uint8_t pin_rx, uint8_t pin_tx);
void begin(unsigned long baudRate);
void begin(unsigned long baudrate, uint16_t config);
void end();