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)
64
64
begin (baudrate, (uint8_t )SERIAL_8N1);
65
65
}
66
66
67
- void Uart::begin (unsigned long baudrate, uint16_t /* config*/ )
67
+ void Uart::begin (unsigned long baudrate, uint16_t config)
68
68
{
69
69
// skip if already begun
70
70
if ( _begun ) return ;
@@ -75,9 +75,17 @@ void Uart::begin(unsigned long baudrate, uint16_t /*config*/)
75
75
if (uc_hwFlow == 1 ) {
76
76
nrfUart->PSELCTS = uc_pinCTS;
77
77
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
+ }
79
83
} 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
+ }
81
89
}
82
90
83
91
uint32_t nrfBaudRate;
You can’t perform that action at this time.
0 commit comments