mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/serial_api.c
- Revision:
- 242:7074e42da0b2
- Parent:
- 227:7bd0639b8911
- Child:
- 293:2a9cf2ed1474
diff -r ffe41b0c8126 -r 7074e42da0b2 targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/serial_api.c --- a/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/serial_api.c Thu Jun 26 10:30:09 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/serial_api.c Fri Jun 27 07:30:09 2014 +0100 @@ -175,10 +175,10 @@ } void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) { - if (data_bits == 8) { + if (data_bits == 9) { + obj->databits = UART_WORDLENGTH_9B; + } else { obj->databits = UART_WORDLENGTH_8B; - } else { - obj->databits = UART_WORDLENGTH_9B; } switch (parity) { @@ -303,7 +303,7 @@ void serial_putc(serial_t *obj, int c) { USART_TypeDef *uart = (USART_TypeDef *)(obj->uart); while (!serial_writable(obj)); - uart->TDR = (uint32_t)(c & 0xFF); + uart->TDR = (uint16_t)(c & 0xFF); } int serial_readable(serial_t *obj) {