Skip to content

Commit 9c99fe9

Browse files
committed
add Uart.setPins() to remap Serial rx, tx
1 parent a0419ad commit 9c99fe9

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cores/nRF5/Uart.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Uart::Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pi
3030
uc_hwFlow = 0;
3131

3232
_mutex = NULL;
33-
3433
_begun = false;
3534
}
3635

@@ -45,10 +44,15 @@ Uart::Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pi
4544
uc_hwFlow = 1;
4645

4746
_mutex = NULL;
48-
4947
_begun = false;
5048
}
5149

50+
void Uart::setPins(uint8_t pin_rx, uint8_t pin_tx)
51+
{
52+
uc_pinRX = pin_rx;
53+
uc_pinTX = pin_tx;
54+
}
55+
5256
void Uart::begin(unsigned long baudrate)
5357
{
5458
begin(baudrate, (uint8_t)SERIAL_8N1);

cores/nRF5/Uart.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class Uart : public HardwareSerial
3232
public:
3333
Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pinTX);
3434
Uart(NRF_UART_Type *_nrfUart, IRQn_Type _IRQn, uint8_t _pinRX, uint8_t _pinTX, uint8_t _pinCTS, uint8_t _pinRTS );
35+
36+
void setPins(uint8_t pin_rx, uint8_t pin_tx);
3537
void begin(unsigned long baudRate);
3638
void begin(unsigned long baudrate, uint16_t config);
3739
void end();

0 commit comments

Comments
 (0)