arduino / arduino/ArduinoCore-API

Ability to set speed in shiftIn & shiftOut

オープン
#83 コメント 1 件 リアクション 7 件 担当者 0 名 GitHub で見る
主要言語
C++
スター
306
フォーク
150
PR マージ指標
30日以内にマージされた PR はありません

説明

While the clock speeds of various Microcontrollers increase, the speed of the shiftIn and shiftOut also increases. This creates a problem when communicating with slower devices. It could be interesting to add an optional argument to these functions so they reliably work with slower devices. Just like with the SPI hardware library where you can set the maximum SPI speed. https://www.arduino.cc/en/Reference/SPI

I had this problem when I was trying to use the 'normal' library for the HX711 load cell amp with an ESP32.
https://github.com/bogde/HX711/issues/75

The interface could look like this:
```cpp

void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val, unsigned long maxSpeed = 0);
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, unsigned long maxSpeed = 0);

```
Where a maxSpeed of 0 would mean that it would use the full speed of the microcontroller. Otherwise you could define the speed as frequency (15Mhz -> 15000000) just like in the SPI hardware library.

In this way Arduino would be future-proof without losing backwards compatibility.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

issue に示されている shiftIn と shiftOut の宣言から始め、要求されている maxSpeed のセマンティクスを Arduino の SPI ハードウェアライブラリのリファレンスと比較します。既存の呼び出しを維持しながら、ESP32/HX711 のケースのような低速なデバイスに対応できる速度処理の方法を判断します。完了条件は、後方互換性を損なわずに API が低速通信をサポートすることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
api, embedded-iot
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。