arduino / arduino/ArduinoCore-API

Low Power Shared API

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

説明

As per ongoing discussion with .org about libraries, here is a proposal for MCU (and companion MCU) standby API

https://github.com/rocketscream/Low-Power is a good starting point, AVR API is too granular so we should avoid it. But the SAMD API is quite good.

Function calls would simply be
- `idle()`
- `sleep()`
- `deepSleep()` -> might call `sleep()` if there is only one sleep mode

which in modern MCU is like WFI with peripherals enabled and WFI with peripherals disabled.
STM32 processors also have a mode called WFE which I would avoid exposing. Other MCU (nRF chips for example) might have multiple sleep levels; I'd select two/three of them to be exposed.

To register a wakeup source I propose overloading `attachInterrupt` API with a couple of versions:
- `attachInterrupt(pin, function, MODE, wakeup)` would become the main function;
- `attachInterrupt(pin, function, MODE, false)` will be called for classic API
- `attachInterruptWakeup(pin, function, MODE)` will call `attachInterrupt(pin, function, MODE, true)`

If function is NULL, wakeup-enable bit should be set and no function called

if `pin` in `NOT_A_PIN`, extra code can handle the additional wakeup sources.
I suggest using macros like `RTC_WAKEUP` or `ADC_WAKEUP` with high values (0xFF, 0FE etc)

@cmaglie @sandeepmistry @tigoe any thoughts about that?

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

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

調査の方向性

issue に記載されている、提案されたエントリポイント idle()、sleep()、deepSleep() と attachInterrupt() のオーバーロードから始めます。次に、参照としてリンクされている Low-Power ライブラリと SAMD API を確認し、サポート対象 MCU の動作とウェイクアップソースの設計を決定します。API 提案のスコープが決定され、実装方針について合意されれば完了です。

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

評価

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

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

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