arduino / arduino/ArduinoCore-API

Low Power Shared API

Abierto
#13 21 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
306
Forks
150
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con los puntos de entrada propuestos idle(), sleep() y deepSleep(), y las sobrecargas de attachInterrupt() descritas en el issue. Revisa después la biblioteca Low-Power enlazada y la SAMD API como referencias, y determina el comportamiento de los MCU compatibles y el diseño de las fuentes de activación. Se considera terminado cuando el alcance de la propuesta de API esté decidido y exista un plan de implementación acordado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
api, embedded-iot
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
20/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.