arduino / arduino/ArduinoCore-API
Low Power Shared API
- Langage dominant
- C++
- Étoiles
- 306
- Forks
- 150
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par les points d’entrée proposés idle(), sleep() et deepSleep(), ainsi que par les surcharges de attachInterrupt() décrits dans l’issue. Consultez ensuite la bibliothèque Low-Power liée et la SAMD API comme références, puis déterminez le comportement des MCU pris en charge et la conception des sources de réveil. Le travail est considéré comme terminé lorsque le périmètre de la proposition d’API est défini et qu’une voie d’implémentation est convenue.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp
- Domaine
- api, embedded-iot
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 20/100