arduino / arduino/ArduinoCore-API

Add flushReceiveBuffer() to HardwareSerial

Open
#89 14 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
306
Forks
150
PR merge metrics
No merged PRs in 30d

Description

In Serial communication sometimes one wants to flush all data in the receive buffer at once. E.g. because data has become invalid. - https://forum.arduino.cc/index.php?topic=530650 -

The code to do this very fast in HardwareSerial is straightforward,
```
void HardwareSerial::flushReceiveBuffer()
{
_rx_buffer_head = _rx_buffer_tail;
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the HardwareSerial declaration and its existing flush-related implementation or tests. Check how the receive buffer is represented and how public API additions are tested; done means the API exposes flushReceiveBuffer() and calling it discards all currently buffered receive data.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, embedded-iot
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.