File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ void Uart::begin(unsigned long baudrate)
6464 begin (baudrate, (uint8_t )SERIAL_8N1);
6565}
6666
67- void Uart::begin (unsigned long baudrate, uint16_t /* config*/ )
67+ void Uart::begin (unsigned long baudrate, uint16_t config)
6868{
6969 // skip if already begun
7070 if ( _begun ) return ;
@@ -75,9 +75,17 @@ void Uart::begin(unsigned long baudrate, uint16_t /*config*/)
7575 if (uc_hwFlow == 1 ) {
7676 nrfUart->PSELCTS = uc_pinCTS;
7777 nrfUart->PSELRTS = uc_pinRTS;
78- nrfUart->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Enabled;
78+ if (config==SERIAL_8E1) {
79+ nrfUart->CONFIG = (UART_CONFIG_PARITY_Included << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Enabled;
80+ } else {
81+ nrfUart->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Enabled;
82+ }
7983 } else {
80- nrfUart->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Disabled;
84+ if (config==SERIAL_8E1) {
85+ nrfUart->CONFIG = (UART_CONFIG_PARITY_Included << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Disabled;
86+ } else {
87+ nrfUart->CONFIG = (UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos) | UART_CONFIG_HWFC_Disabled;
88+ }
8189 }
8290
8391 uint32_t nrfBaudRate;
You can’t perform that action at this time.
0 commit comments