refactor the use of g_APinDescription ?
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 30/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- cpp
- 領域
- embedded-iot
調査の方向性
まず、variant.h と Arduino.h のアクセスマクロを、g_APinDescription と digital_pin_to_xxx を含め、cores/arduino/Tone.cpp での配列の直接使用と比較します。現在直接アクセスされているピン関連データを洗い出し、オーバーライド可能な正式 API の範囲を定義します。core とライブラリのコードが特定の実装を前提とせずにそれらの定義を使用する状態を完了とします。
索引モデルが issue の本文から書いたものです。
説明
It bothers me, in a sort of "Code Purity" sense, that so many core and library functions access
the g_APinDescription[] (for sam/samd) or digital_pin_to_xxx[] (for avr) arrays directly.
There are some macros in variant.h or Arduino.h (digitalPinToBitMask and similar), but they are not consistently used, not all functions have macros, and sometimes they aren't well-placed WRT redefining them for new board types.
Example:
variants/mkr1000/variant.h:47: #define digitalPinToBitMask(P) (1 << g_APinDescription[P].ulPin)
cores/arduino/Tone.cpp:133: portBitMask = (1ul << g_APinDescription[outputPin].ulPin);
The definition of a more formal API presents the opportunity to offer more formal rules:
-
macros or inline functions to access all pin-related data should be defined in the variant-specific files, or perhaps WVariant.h for core-wide data.
-
if such definitions are defined in core-wide functions, it should be possible to override them in variant-specific files.
-
All other code should use these definitions, instead of assuming a particular implementation. (the tone.cpp example above should not exist, even now.)
The immediate practical benefit would be the possibility of more compact implementations for the "tiny" chips (avr tiny, SAMD11, etc), and greater portability of the functions in the "upper level" areas of code.
- 主要言語
- C++
- スター
- 306
- フォーク
- 150
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
arduino/ArduinoCore-API のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
arduino/ArduinoCore-API#261 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 30/100
arduino/ArduinoCore-API#256 ·
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
arduino/ArduinoCore-API#251 · コメント 1 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
arduino/ArduinoCore-API#250 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
arduino/ArduinoCore-API#249 ·
arduino/ArduinoCore-API の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google/libultrahdr#485 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
godotengine/godot#123776 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 60/100
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ros2/common_interfaces#344 ·