Fix parity support on USB UART interface.

This commit is contained in:
Gareth McMullin 2014-07-30 19:57:18 +12:00
parent 2b61bed291
commit fad6eb3c14
1 changed files with 7 additions and 1 deletions

View File

@ -138,7 +138,12 @@ static void usbuart_run(void)
void usbuart_set_line_coding(struct usb_cdc_line_coding *coding) void usbuart_set_line_coding(struct usb_cdc_line_coding *coding)
{ {
usart_set_baudrate(USBUSART, coding->dwDTERate); 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) { switch(coding->bCharFormat) {
case 0: case 0:
usart_set_stopbits(USBUSART, USART_STOPBITS_1); 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); usart_set_stopbits(USBUSART, USART_STOPBITS_2);
break; break;
} }
switch(coding->bParityType) { switch(coding->bParityType) {
case 0: case 0:
usart_set_parity(USBUSART, USART_PARITY_NONE); usart_set_parity(USBUSART, USART_PARITY_NONE);