drivers: serial: nrfx: ifdef optional baudrates

Some baudrates are not supported in certain SoCs.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Marcin Szymczyk 2022-03-31 14:57:23 +02:00 committed by Carles Cufí
parent 62eecf9142
commit 6e5f432eee
2 changed files with 8 additions and 0 deletions

View file

@ -221,15 +221,19 @@ static int baudrate_set(const struct device *dev, uint32_t baudrate)
case 28800: case 28800:
nrf_baudrate = NRF_UART_BAUDRATE_28800; nrf_baudrate = NRF_UART_BAUDRATE_28800;
break; break;
#if defined(UART_BAUDRATE_BAUDRATE_Baud31250)
case 31250: case 31250:
nrf_baudrate = NRF_UART_BAUDRATE_31250; nrf_baudrate = NRF_UART_BAUDRATE_31250;
break; break;
#endif
case 38400: case 38400:
nrf_baudrate = NRF_UART_BAUDRATE_38400; nrf_baudrate = NRF_UART_BAUDRATE_38400;
break; break;
#if defined(UART_BAUDRATE_BAUDRATE_Baud56000)
case 56000: case 56000:
nrf_baudrate = NRF_UART_BAUDRATE_56000; nrf_baudrate = NRF_UART_BAUDRATE_56000;
break; break;
#endif
case 57600: case 57600:
nrf_baudrate = NRF_UART_BAUDRATE_57600; nrf_baudrate = NRF_UART_BAUDRATE_57600;
break; break;

View file

@ -379,15 +379,19 @@ static int baudrate_set(const struct device *dev, uint32_t baudrate)
case 28800: case 28800:
nrf_baudrate = NRF_UARTE_BAUDRATE_28800; nrf_baudrate = NRF_UARTE_BAUDRATE_28800;
break; break;
#if defined(UARTE_BAUDRATE_BAUDRATE_Baud31250)
case 31250: case 31250:
nrf_baudrate = NRF_UARTE_BAUDRATE_31250; nrf_baudrate = NRF_UARTE_BAUDRATE_31250;
break; break;
#endif
case 38400: case 38400:
nrf_baudrate = NRF_UARTE_BAUDRATE_38400; nrf_baudrate = NRF_UARTE_BAUDRATE_38400;
break; break;
#if defined(UARTE_BAUDRATE_BAUDRATE_Baud56000)
case 56000: case 56000:
nrf_baudrate = NRF_UARTE_BAUDRATE_56000; nrf_baudrate = NRF_UARTE_BAUDRATE_56000;
break; break;
#endif
case 57600: case 57600:
nrf_baudrate = NRF_UARTE_BAUDRATE_57600; nrf_baudrate = NRF_UARTE_BAUDRATE_57600;
break; break;