mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2822 from anangl/master
TARGET_NRF5: Removed waiting for TX completed from 'serial_putc()'.pull/2828/merge
commit
2564a833c0
|
@ -258,11 +258,15 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
|
|||
nrf_gpio_cfg_input(UART_CB.pselrxd, NRF_GPIO_PIN_NOPULL);
|
||||
}
|
||||
|
||||
// UART pins must only be configured when the peripheral is disabled.
|
||||
nrf_uart_disable(UART_INSTANCE);
|
||||
|
||||
if (UART_CB.initialized) {
|
||||
// Reconfigure RX/TX pins only.
|
||||
// For already initialized peripheral it is sufficient to reconfigure
|
||||
// RX/TX pins only.
|
||||
|
||||
// Ensure that there is no unfinished TX transfer.
|
||||
while (!serial_writable(obj)) {
|
||||
}
|
||||
// UART pins can be configured only when the peripheral is disabled.
|
||||
nrf_uart_disable(UART_INSTANCE);
|
||||
nrf_uart_txrx_pins_set(UART_INSTANCE, UART_CB.pseltxd, UART_CB.pselrxd);
|
||||
nrf_uart_enable(UART_INSTANCE);
|
||||
}
|
||||
|
@ -479,9 +483,6 @@ void serial_putc(serial_t *obj, int c)
|
|||
|
||||
nrf_uart_event_clear(UART_INSTANCE, NRF_UART_EVENT_TXDRDY);
|
||||
nrf_uart_txd_set(UART_INSTANCE, (uint8_t)c);
|
||||
// Wait until sending is completed.
|
||||
while (!nrf_uart_event_check(UART_INSTANCE, NRF_UART_EVENT_TXDRDY)) {
|
||||
}
|
||||
}
|
||||
|
||||
int serial_readable(serial_t *obj)
|
||||
|
|
Loading…
Reference in New Issue