1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Serial.flush modification (#5293)

* Modify Serial.flush

* Add function to uart tests
This commit is contained in:
dsv19
2019-10-08 15:36:39 +03:00
committed by Earle F. Philhower, III
parent 8b16d9c1d1
commit 8c3f1be63f
4 changed files with 25 additions and 2 deletions

View File

@ -48,6 +48,10 @@
#include "user_interface.h"
#include "uart_register.h"
#define MODE2WIDTH(mode) (((mode%16)>>2)+5)
#define MODE2STOP(mode) (((mode)>>5)+1)
#define MODE2PARITY(mode) (mode%4)
/*
Some general architecture for GDB integration with the UART to enable
serial debugging.
@ -204,7 +208,14 @@ uart_read_char_unsafe(uart_t* uart)
return -1;
}
size_t
uint8_t
uart_get_bit_length(const int uart_nr)
{
// return bit length from uart mode, +1 for the start bit which is always there.
return MODE2WIDTH(USC0(uart_nr)) + MODE2PARITY(USC0(uart_nr)) + MODE2STOP(USC0(uart_nr)) + 1;
}
size_t
uart_rx_available(uart_t* uart)
{
if(uart == NULL || !uart->rx_enabled)