arduino / arduino/ArduinoCore-API
add isFlushed() to Stream/HardwareSerial
- 主要言語
- C++
- スター
- 306
- フォーク
- 150
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Please add Serial.isFlushed() method for checking that all data in Tx buffer have been flushed. We need it for non-blocking Serial.write() to half duplex communication (such as RS485).
At the moment I use something like this in my non-blocking code:
```
while (Serial.availableForWrite() > 0 && ndx < sizeof(buffer)) {
Serial.write(buffer[ndx]);
ndx++;
}
if (Serial.availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1 && ndx > sizeof(buffer)) {
ndx = 0;
// Disable RS485 transmit and start receiving
}
```
But Serial.availableForWrite() == SERIAL_TX_BUFFER_SIZE - 1 is not reliable for checking that Tx buffer has been flushed.
Here is an earlier PR which was never merged:
https://github.com/arduino/Arduino/pull/3737
and a similar PR for ArduinoCore-sam here:
https://github.com/arduino/ArduinoCore-sam/pull/7
I would help, but coding Arduino core is beyond my skills.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
まず Stream/HardwareSerial と issue にリンクされている以前の Arduino PRs を確認し、提案されている API と影響を受ける core 実装を理解します。現在、送信バッファの状態がどのように公開されているかを確認し、Serial.isFlushed() が half-duplex 用にすべての送信データがバッファを出たことを確実に報告することを完了条件とします。また、関連する core がシリアル動作をテストしている箇所に、対応するカバレッジを追加します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- api, embedded-iot
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100