nrf5: uart: Add support for 300 and 600 baud rates.

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
This commit is contained in:
Michał Kruszewski 2017-07-19 16:43:11 +02:00 committed by Kumar Gala
commit fda632adec
2 changed files with 8 additions and 0 deletions

View file

@ -68,6 +68,8 @@
* Uses the UARTE_BAUDRATE macros since they are more precise. * Uses the UARTE_BAUDRATE macros since they are more precise.
*/ */
#define NRF5_UART_BAUDRATE_300 0x00014000
#define NRF5_UART_BAUDRATE_600 0x00027000
#define NRF5_UART_BAUDRATE_1200 0x0004f000 #define NRF5_UART_BAUDRATE_1200 0x0004f000
#define NRF5_UART_BAUDRATE_2400 0x0009d000 #define NRF5_UART_BAUDRATE_2400 0x0009d000
#define NRF5_UART_BAUDRATE_4800 0x0013b000 #define NRF5_UART_BAUDRATE_4800 0x0013b000

View file

@ -121,6 +121,12 @@ static int baudrate_set(struct device *dev,
/* Use the common nRF5 macros */ /* Use the common nRF5 macros */
switch (baudrate) { switch (baudrate) {
case 300:
divisor = NRF5_UART_BAUDRATE_300;
break;
case 600:
divisor = NRF5_UART_BAUDRATE_600;
break;
case 1200: case 1200:
divisor = NRF5_UART_BAUDRATE_1200; divisor = NRF5_UART_BAUDRATE_1200;
break; break;