BV UART: wait for transfer to complete before switching it off
This commit is contained in:
parent
0156f349bc
commit
e9b88c49b3
|
@ -280,7 +280,7 @@ void busvoodoo_uart_generic_exit(void)
|
|||
gpio_set_mode(busvoodoo_uart_generic_specific->rx_port, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, busvoodoo_uart_generic_specific->rx_pin); // set pin back to floating input
|
||||
if (busvoodoo_uart_generic_specific->hwflowctl) {
|
||||
gpio_set_mode(busvoodoo_uart_generic_specific->rts_port, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, busvoodoo_uart_generic_specific->rts_pin); // set pin back to floating input
|
||||
gpio_set_mode(busvoodoo_uart_generic_specific->cts_pin, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, busvoodoo_uart_generic_specific->cts_pin); // set pin back to floating input
|
||||
gpio_set_mode(busvoodoo_uart_generic_specific->cts_port, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, busvoodoo_uart_generic_specific->cts_pin); // set pin back to floating input
|
||||
}
|
||||
if (busvoodoo_uart_generic_specific->multidrive) {
|
||||
busvoodoo_embedded_pullup(false); // disable embedded pull-ups
|
||||
|
@ -307,6 +307,7 @@ static void busvoodoo_uart_generic_write(uint8_t value)
|
|||
// display data send
|
||||
printf("write: '%c'/0x%02x\n", value, value);
|
||||
}
|
||||
while ((0==((USART_SR(busvoodoo_uart_generic_specific->usart)) & USART_SR_TC) && !user_input_available)); // wait for transfer to be complete
|
||||
if (user_input_available) { // user interrupted flow
|
||||
user_input_get(); // discard user input
|
||||
}
|
||||
|
@ -520,6 +521,7 @@ static void busvoodoo_uart_generic_command_transmit(void* argument)
|
|||
usart_enhanced_send(busvoodoo_uart_generic_specific->usart, ((char*)(argument))[i]); // transmit character
|
||||
}
|
||||
}
|
||||
while ((0==((USART_SR(busvoodoo_uart_generic_specific->usart)) & USART_SR_TC) && !user_input_available)); // wait for transfer to be complete
|
||||
if (user_input_available) { // user interrupted flow
|
||||
user_input_get(); // discard user input
|
||||
}
|
||||
|
@ -612,6 +614,7 @@ static void busvoodoo_uart_generic_command_transceive(void* argument)
|
|||
usart_enhanced_send(busvoodoo_uart_generic_specific->usart, c); // send user character
|
||||
busvoodoo_led_blue_pulse(BUSVOODOO_LED_PULSE); // enable blue LED to show transmission
|
||||
}
|
||||
while ((0==((USART_SR(busvoodoo_uart_generic_specific->usart)) & USART_SR_TC) && !user_input_available)); // wait for transfer to be complete
|
||||
if (busvoodoo_uart_generic_specific->tx_post) {
|
||||
(*busvoodoo_uart_generic_specific->tx_post)();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue