From fad6eb3c148ac463c04c3762fc21b03a4db1f8e2 Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Wed, 30 Jul 2014 19:57:18 +1200 Subject: [PATCH] Fix parity support on USB UART interface. --- src/platforms/stm32/usbuart.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c index 95371dd..f8f56bf 100644 --- a/src/platforms/stm32/usbuart.c +++ b/src/platforms/stm32/usbuart.c @@ -138,7 +138,12 @@ static void usbuart_run(void) void usbuart_set_line_coding(struct usb_cdc_line_coding *coding) { usart_set_baudrate(USBUSART, coding->dwDTERate); - usart_set_databits(USBUSART, coding->bDataBits); + + if (coding->bParityType) + usart_set_databits(USBUSART, coding->bDataBits + 1); + else + usart_set_databits(USBUSART, coding->bDataBits); + switch(coding->bCharFormat) { case 0: usart_set_stopbits(USBUSART, USART_STOPBITS_1); @@ -150,6 +155,7 @@ void usbuart_set_line_coding(struct usb_cdc_line_coding *coding) usart_set_stopbits(USBUSART, USART_STOPBITS_2); break; } + switch(coding->bParityType) { case 0: usart_set_parity(USBUSART, USART_PARITY_NONE);