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);