Skip to content

Commit 17cbf25

Browse files
committed
corrected defines needed when parity is used
When the parity control is enabled, the computed parity is inserted at the MSB position (9th bit if M=1; 8th bit if M=0) and parity is checked on the received data. This excludes 9 bit long words + parity bit.
1 parent b81d7b7 commit 17cbf25

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

STM32F1/cores/maple/HardwareSerial.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,25 @@ struct usart_dev;
8383
*/
8484
// Define config for Serial.begin(baud, config);
8585
// Note. STM32 doesn't support as many different Serial modes as AVR or SAM cores.
86+
// The word legth bit M must be set when using parity bit.
8687

8788
#define SERIAL_8N1 0B00000000
8889
#define SERIAL_8N2 0B00100000
8990
#define SERIAL_9N1 0B00001000
9091
#define SERIAL_9N2 0B00101000
9192

92-
#define SERIAL_8E1 0B00000010
93-
#define SERIAL_8E2 0B00100010
93+
#define SERIAL_8E1 0B00001010
94+
#define SERIAL_8E2 0B00101010
95+
/* not supported:
9496
#define SERIAL_9E1 0B00001010
9597
#define SERIAL_9E2 0B00101010
96-
97-
#define SERIAL_8O1 0B00000011
98-
#define SERIAL_8O2 0B00100011
98+
*/
99+
#define SERIAL_8O1 0B00001011
100+
#define SERIAL_8O2 0B00101011
101+
/* not supported:
99102
#define SERIAL_9O1 0B00001011
100103
#define SERIAL_9O2 0B00101011
101-
104+
*/
102105

103106
/* Roger Clark
104107
* Moved macros from hardwareSerial.cpp

0 commit comments

Comments
 (0)