mirror of
https://github.com/elua/elua.git
synced 2025-01-25 01:02:54 +08:00
eLua - platform - uart - handle mark/space parity - lm3s, lpc17xx, at91sam, avr32
This commit is contained in:
parent
cb4f98640b
commit
71c060bb81
@ -239,6 +239,10 @@ u32 platform_uart_setup( unsigned id, u32 baud, int databits, int parity, int st
|
|||||||
mode |= AT91C_US_PAR_EVEN;
|
mode |= AT91C_US_PAR_EVEN;
|
||||||
else if( parity == PLATFORM_UART_PARITY_ODD )
|
else if( parity == PLATFORM_UART_PARITY_ODD )
|
||||||
mode |= AT91C_US_PAR_ODD;
|
mode |= AT91C_US_PAR_ODD;
|
||||||
|
else if( parity == PLATFORM_UART_PARITY_MARK )
|
||||||
|
mode |= AT91C_US_PAR_MARK;
|
||||||
|
else if( parity == PLATFORM_UART_PARITY_SPACE )
|
||||||
|
mode |= AT91C_US_PAR_SPACE;
|
||||||
else
|
else
|
||||||
mode |= AT91C_US_PAR_NONE;
|
mode |= AT91C_US_PAR_NONE;
|
||||||
if( stopbits == PLATFORM_UART_STOPBITS_1 )
|
if( stopbits == PLATFORM_UART_STOPBITS_1 )
|
||||||
|
@ -391,6 +391,12 @@ u32 platform_uart_setup( unsigned id, u32 baud, int databits, int parity, int st
|
|||||||
case PLATFORM_UART_PARITY_ODD:
|
case PLATFORM_UART_PARITY_ODD:
|
||||||
opts.paritytype = USART_ODD_PARITY;
|
opts.paritytype = USART_ODD_PARITY;
|
||||||
break;
|
break;
|
||||||
|
case PLATFORM_UART_PARITY_SPACE:
|
||||||
|
opts.paritytype = USART_SPACE_PARITY;
|
||||||
|
break;
|
||||||
|
case PLATFORM_UART_PARITY_MARK:
|
||||||
|
opts.paritytype = USART_MARK_PARITY;
|
||||||
|
break;
|
||||||
case PLATFORM_UART_PARITY_NONE:
|
case PLATFORM_UART_PARITY_NONE:
|
||||||
opts.paritytype = USART_NO_PARITY;
|
opts.paritytype = USART_NO_PARITY;
|
||||||
break;
|
break;
|
||||||
|
@ -525,6 +525,10 @@ u32 platform_uart_setup( unsigned id, u32 baud, int databits, int parity, int st
|
|||||||
config |= UART_CONFIG_PAR_EVEN;
|
config |= UART_CONFIG_PAR_EVEN;
|
||||||
else if( parity == PLATFORM_UART_PARITY_ODD )
|
else if( parity == PLATFORM_UART_PARITY_ODD )
|
||||||
config |= UART_CONFIG_PAR_ODD;
|
config |= UART_CONFIG_PAR_ODD;
|
||||||
|
else if( parity == PLATFORM_UART_PARITY_MARK )
|
||||||
|
config |= UART_CONFIG_PAR_ONE;
|
||||||
|
else if( parity == PLATFORM_UART_PARITY_SPACE )
|
||||||
|
config |= UART_CONFIG_PAR_ZERO;
|
||||||
else
|
else
|
||||||
config |= UART_CONFIG_PAR_NONE;
|
config |= UART_CONFIG_PAR_NONE;
|
||||||
|
|
||||||
|
@ -223,6 +223,14 @@ u32 platform_uart_setup( unsigned id, u32 baud, int databits, int parity, int st
|
|||||||
case PLATFORM_UART_PARITY_EVEN:
|
case PLATFORM_UART_PARITY_EVEN:
|
||||||
UARTConfigStruct.Parity = UART_PARITY_EVEN;
|
UARTConfigStruct.Parity = UART_PARITY_EVEN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PLATFORM_UART_PARITY_MARK:
|
||||||
|
UARTConfigStruct.Parity = UART_PARITY_SP_1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PLATFORM_UART_PARITY_SPACE:
|
||||||
|
UARTConfigStruct.Parity = UART_PARITY_SP_0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
UART_Init(uart[ id ], &UARTConfigStruct);
|
UART_Init(uart[ id ], &UARTConfigStruct);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user