platform: platform_uart_setup handles null ptr
This commit is contained in:
parent
01b94f31dc
commit
ca0a2b3f47
|
@ -209,8 +209,10 @@ static void task_uart( void *pvParameters ){
|
||||||
uint32_t platform_uart_setup( unsigned id, uint32_t baud, int databits, int parity, int stopbits, uart_pins_t* pins )
|
uint32_t platform_uart_setup( unsigned id, uint32_t baud, int databits, int parity, int stopbits, uart_pins_t* pins )
|
||||||
{
|
{
|
||||||
int flow_control = UART_HW_FLOWCTRL_DISABLE;
|
int flow_control = UART_HW_FLOWCTRL_DISABLE;
|
||||||
|
if (pins != NULL) {
|
||||||
if(pins->flow_control & PLATFORM_UART_FLOW_CTS) flow_control |= UART_HW_FLOWCTRL_CTS;
|
if(pins->flow_control & PLATFORM_UART_FLOW_CTS) flow_control |= UART_HW_FLOWCTRL_CTS;
|
||||||
if(pins->flow_control & PLATFORM_UART_FLOW_RTS) flow_control |= UART_HW_FLOWCTRL_RTS;
|
if(pins->flow_control & PLATFORM_UART_FLOW_RTS) flow_control |= UART_HW_FLOWCTRL_RTS;
|
||||||
|
}
|
||||||
|
|
||||||
uart_config_t cfg = {
|
uart_config_t cfg = {
|
||||||
.baud_rate = baud,
|
.baud_rate = baud,
|
||||||
|
|
Loading…
Reference in New Issue