mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-13 02:22:55 +03:00
uart: BW improvements (#4620)
* uart fixes and BW improvements * uart: read_char straightly use hw buffer * +attributes for functions called by ISR * uart: BW improvements read_char straightly use hw buffer (+ ~10%bw) read by block (+ ~190%bw) (instead of generic Stream::readBytes) attributes for functions called by ISR remove overrun message remove some ISR flags which were not honoured * fix merge * fix buffer overflow * serial stress test sketch * astyle * serial stress example: interactive keyboard, stop reading, overrun * serial device test: bandwidth & overrun * update + HardwareSerial::hasError() * interactive overrun in example * astyle * Test using @plerup's SoftwareSerial as submodule (tag 3.4.1) * update upstream ref (fix warning) * host mock uart/read(buf,size) * reset style changes in submodules before style diff * update build_boards_manager_package.sh for submodules * trigger CI (removing space) * cannot reproduce locally the CI issue, setting bash -x option to get live trace * remove previously added (in this PR) 'set -e' in package builder (passes local tests, not real CI) script-comment new recipe.hooks.core.prebuild.3 (along with already commented .1 and .2) moved CI package test to be first on the test list remove 'set -x', wish me luck
This commit is contained in:
@ -88,6 +88,10 @@ public:
|
||||
void end();
|
||||
|
||||
size_t setRxBufferSize(size_t size);
|
||||
size_t getRxBufferSize()
|
||||
{
|
||||
return uart_get_rx_buffer_size(_uart);
|
||||
}
|
||||
|
||||
void swap()
|
||||
{
|
||||
@ -120,14 +124,22 @@ public:
|
||||
|
||||
int peek(void) override
|
||||
{
|
||||
// this may return -1, but that's okay
|
||||
// return -1 when data is unvailable (arduino api)
|
||||
return uart_peek_char(_uart);
|
||||
}
|
||||
int read(void) override
|
||||
{
|
||||
// this may return -1, but that's okay
|
||||
// return -1 when data is unvailable (arduino api)
|
||||
return uart_read_char(_uart);
|
||||
}
|
||||
size_t readBytes(char* buffer, size_t size) override
|
||||
{
|
||||
return uart_read(_uart, buffer, size);
|
||||
}
|
||||
size_t readBytes(uint8_t* buffer, size_t size) override
|
||||
{
|
||||
return uart_read(_uart, (char*)buffer, size);
|
||||
}
|
||||
int availableForWrite(void)
|
||||
{
|
||||
return static_cast<int>(uart_tx_free(_uart));
|
||||
@ -184,6 +196,11 @@ public:
|
||||
return uart_has_overrun(_uart);
|
||||
}
|
||||
|
||||
bool hasRxError(void)
|
||||
{
|
||||
return uart_has_rx_error(_uart);
|
||||
}
|
||||
|
||||
void startDetectBaudrate();
|
||||
|
||||
unsigned long testBaudrate();
|
||||
|
Reference in New Issue
Block a user