arduino / arduino/ArduinoCore-API
Low Power Shared API
- Vorherrschende Sprache
- C++
- Sterne
- 306
- Forks
- 150
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit den in diesem Issue beschriebenen vorgeschlagenen Einstiegspunkten idle(), sleep() und deepSleep() sowie den Überladungen von attachInterrupt(). Sieh dir anschließend die verknüpfte Low-Power-Bibliothek und die SAMD API als Referenzen an und bestimme dann das Verhalten der unterstützten MCUs sowie das Design der Aufwachquellen. Als erledigt gilt die Aufgabe, wenn der Umfang des API-Vorschlags festgelegt und ein Implementierungspfad vereinbart ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- api, embedded-iot
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100