ESP32: add support to light sleep#1789
Conversation
778ca20 to
0cb4308
Compare
| } | ||
| #endif | ||
|
|
||
| static term nif_esp_gpio_wakeup_enable(Context *ctx, int argc, term argv[]) |
There was a problem hiding this comment.
I would call this gpio:wakeup_enable/2 to match with the esp-idf function name.
There was a problem hiding this comment.
this means we are leaking more ESP32 specific stuff into GPIO module. I think they can be made somehow generic, but I'm not sure how.
|
There is something that I'd like to here the opinion about: Should we use the |
We could use BEAM documentation reads:
|
0cb4308 to
4d62044
Compare
This is an interesting suggestion, and might be useful to expose an API for pushing other “monitored” events, like acquiring or loosing a network connection. I think some standardized notification system would be good, but it should be opt in, so extra resources are not consumed if they are not used. |
|
lgtm, there is also some docs over here:
AtomVM/doc/src/build-instructions.md Line 384 in 6330d9f that needs updating |
4d62044 to
a07cef1
Compare
src/libAtomVM/jit.c
Outdated
| if (n <= 64) { | ||
| union maybe_unsigned_int64 value; | ||
| bool status = bitstring_extract_integer( | ||
| ((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term
src/libAtomVM/jit.c
Outdated
| bool status; | ||
| switch (n) { | ||
| case 16: | ||
| status = bitstring_extract_f16(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term
src/libAtomVM/jit.c
Outdated
| status = bitstring_extract_f16(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); | ||
| break; | ||
| case 32: | ||
| status = bitstring_extract_f32(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term
src/libAtomVM/jit.c
Outdated
| status = bitstring_extract_f32(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); | ||
| break; | ||
| case 64: | ||
| status = bitstring_extract_f64(((term) bin_ptr) | TERM_PRIMARY_BOXED, offset, n, bs_flags, &value); |
Check failure
Code scanning / CodeQL
Passing a non-term to a function expecting a term
doc/src/build-instructions.md
Outdated
| #### Sleep mode - Light sleep | ||
|
|
||
| Usage of light sleep is untested, and no support for controlling light sleep is currently implemented. Reach out if you do any experiments and measurements. | ||
| Light sleep is supported as well and can be enabled on ESP32 using the releated functions. When using light sleep memory is retained, and execution is resumed as soon as wakeup is triggered from a wakeup source. |
a07cef1 to
28023c0
Compare
Allow putting ESP32 to light sleep, and wake it up using a GPIO or a timer. Signed-off-by: Davide Bettio <davide@uninstall.it>
28023c0 to
183c398
Compare
petermm
left a comment
There was a problem hiding this comment.
LGTM - we just need to remember build_instructions.md when forwarding it to main..
Merge ESP32 light sleep support (#1789) from release-0.6 branch.
After atomvm#1789 (and the subsequent forward port from release-0.6), light sleep has been introduced in main. Update newer documentation accordingly. Signed-off-by: Davide Bettio <davide@uninstall.it>
After atomvm#1789 (and the subsequent forward port from release-0.6), light sleep has been merged in main. Update newer documentation accordingly. Signed-off-by: Davide Bettio <davide@uninstall.it>
After atomvm#1789 (and the subsequent forward port from release-0.6), light sleep has been merged in main. Update newer documentation accordingly. Signed-off-by: Davide Bettio <davide@uninstall.it>
Allow putting ESP32 to light sleep, and wake it up using a GPIO or a timer.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later