Skip to content

Initial alarm and sleep PR: time alarms with light and deep sleep; PinAlarms not yet implemented #3767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
90b9ec6
Initial Sleep Support
microdev1 Sep 18, 2020
3a30887
Update soft reboot message
microdev1 Sep 18, 2020
e310b87
Get io wake working
microdev1 Sep 19, 2020
05a3f20
Add function to get time elapsed during sleep
microdev1 Sep 22, 2020
21ba61a
Add function to disable alarm
microdev1 Sep 22, 2020
e5ff55b
Renamed alarm modules
microdev1 Sep 23, 2020
4d8ffdc
restructure alarm modules
microdev1 Sep 24, 2020
da44972
Fix build error
microdev1 Sep 24, 2020
59df1a1
Add alarm_touch module
microdev1 Sep 24, 2020
e359389
Add description of alarm modules
microdev1 Sep 24, 2020
930cf14
Add check for invalid io, function to disable all alarms
microdev1 Sep 26, 2020
0e444f0
Implement sleep on code.py exit
microdev1 Sep 30, 2020
354536c
Update translation
microdev1 Oct 7, 2020
1196d4b
move to new module
tannewt Oct 14, 2020
85dadf3
More API changes
tannewt Oct 15, 2020
9a4efed
Start tweaking the workflow to sleep
tannewt Oct 28, 2020
bb77f1d
wip: initial code changes, starting from @tannewt's sleepio branch
dhalbert Nov 16, 2020
ffff02c
Merge remote-tracking branch 'adafruit/main' into sleep
dhalbert Nov 16, 2020
682054a
WIP: redo API; not compiled yet
dhalbert Nov 19, 2020
5bb3c32
merge from main
dhalbert Nov 19, 2020
649c930
wip
dhalbert Nov 19, 2020
cd436ba
Merge remote-tracking branch 'adafruit/main' into sleep
dhalbert Nov 19, 2020
39e1f52
wip; not compiling yet
dhalbert Nov 19, 2020
e4c6699
compiles
dhalbert Nov 21, 2020
75559f3
wip: ResetReason to microcontroller.cpu
dhalbert Nov 22, 2020
a0f1ec3
wip
dhalbert Nov 23, 2020
25591a3
Merge branch 'esp32s2-common-hal-mcu-delay-us' into sleep
dhalbert Nov 23, 2020
3abee9b
compiles; maybe ready to test, or almost
dhalbert Nov 23, 2020
7a45afc
working, but need to avoid deep sleeping too fast before USB ready
dhalbert Nov 24, 2020
f868cc5
some API renaming and bug fixes; fix docs
dhalbert Nov 25, 2020
9dbea36
changed alarm.time API
dhalbert Nov 25, 2020
ef0830b
merge from upstream + wip
dhalbert Nov 25, 2020
104a089
deep sleep working; deep sleep delay when connected
dhalbert Nov 27, 2020
e308a9e
working! PinAlarm not implemented yet.
dhalbert Nov 27, 2020
596e0e4
merge from upstream
dhalbert Nov 27, 2020
f96475c
update Requests; rolled back by accident
dhalbert Nov 27, 2020
65e2fe4
fix stub problems; touch up doc
dhalbert Nov 28, 2020
2830cc9
make translate
dhalbert Nov 28, 2020
28d9e91
Disable complex arithmetic on SAMD21 builds to make space
dhalbert Nov 28, 2020
8b7c23c
address review comments
dhalbert Dec 2, 2020
72fa7d8
fix doc errors
dhalbert Dec 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/utils/pyexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
#endif
}

// If the code was loaded from a file its likely to be running for a while so we'll long
// If the code was loaded from a file it's likely to be running for a while so we'll long
// live it and collect any garbage before running.
if (input_kind == MP_PARSE_FILE_INPUT) {
module_fun = make_obj_long_lived(module_fun, 6);
Expand Down Expand Up @@ -132,6 +132,10 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
// at the moment, the value of SystemExit is unused
ret = pyexec_system_exit;
#if CIRCUITPY_ALARM
} else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_DeepSleepRequest)) {
ret = PYEXEC_DEEP_SLEEP;
#endif
} else {
if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
Expand Down
1 change: 1 addition & 0 deletions lib/utils/pyexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern int pyexec_system_exit;
#define PYEXEC_FORCED_EXIT (0x100)
#define PYEXEC_SWITCH_MODE (0x200)
#define PYEXEC_EXCEPTION (0x400)
#define PYEXEC_DEEP_SLEEP (0x800)

int pyexec_raw_repl(void);
int pyexec_friendly_repl(void);
Expand Down
44 changes: 42 additions & 2 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-24 15:40-0500\n"
"POT-Creation-Date: 2020-11-27 23:57-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -844,6 +844,10 @@ msgstr ""
msgid "Expected an Address"
msgstr ""

#: shared-bindings/alarm/__init__.c
msgid "Expected an alarm"
msgstr ""

#: shared-module/_pixelbuf/PixelBuf.c
#, c-format
msgid "Expected tuple of length %d, got %d"
Expand Down Expand Up @@ -989,6 +993,10 @@ msgstr ""
msgid "I2SOut not available"
msgstr ""

#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "IOs 0, 2 & 4 do not support internal pullup in sleep"
msgstr ""

#: shared-bindings/aesio/aes.c
#, c-format
msgid "IV must be %d bytes long"
Expand Down Expand Up @@ -1440,6 +1448,10 @@ msgid ""
"%d bpp given"
msgstr ""

#: ports/esp32s2/common-hal/alarm/__init__.c
msgid "Only one alarm.time alarm can be set."
msgstr ""

#: shared-module/displayio/ColorConverter.c
msgid "Only one color can be transparent at a time"
msgstr ""
Expand Down Expand Up @@ -1497,6 +1509,10 @@ msgstr ""
msgid "Pin number already reserved by EXTI"
msgstr ""

#: ports/esp32s2/common-hal/alarm/__init__.c
msgid "PinAlarm not yet implemented"
msgstr ""

#: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format
msgid ""
Expand Down Expand Up @@ -1558,7 +1574,7 @@ msgstr ""
msgid "RTC calibration is not supported on this board"
msgstr ""

#: shared-bindings/time/__init__.c
#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c
msgid "RTC is not supported on this board"
msgstr ""

Expand Down Expand Up @@ -1704,6 +1720,10 @@ msgstr ""
msgid "Supply at least one UART pin"
msgstr ""

#: shared-bindings/alarm/time/TimeAlarm.c
msgid "Supply one of monotonic_time or epoch_time"
msgstr ""

#: shared-bindings/gnss/GNSS.c
msgid "System entry must be gnss.SatelliteSystem"
msgstr ""
Expand Down Expand Up @@ -1767,6 +1787,10 @@ msgstr ""
msgid "Tile width must exactly divide bitmap width"
msgstr ""

#: shared-bindings/alarm/time/TimeAlarm.c
msgid "Time is in the past."
msgstr ""

#: ports/nrf/common-hal/_bleio/Adapter.c
#, c-format
msgid "Timeout is too long: Maximum timeout length is %d seconds"
Expand Down Expand Up @@ -2481,6 +2505,10 @@ msgstr ""
msgid "end_x should be an int"
msgstr ""

#: shared-bindings/alarm/time/TimeAlarm.c
msgid "epoch_time not supported on this board"
msgstr ""

#: ports/nrf/common-hal/busio/UART.c
#, c-format
msgid "error = 0x%08lX"
Expand Down Expand Up @@ -2850,6 +2878,10 @@ msgstr ""
msgid "invalid syntax for number"
msgstr ""

#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "io must be rtc io"
msgstr ""

#: py/objtype.c
msgid "issubclass() arg 1 must be a class"
msgstr ""
Expand Down Expand Up @@ -3537,6 +3569,10 @@ msgstr ""
msgid "trapz is defined for 1D arrays of equal length"
msgstr ""

#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "trigger level must be 0 or 1"
msgstr ""

#: extmod/ulab/code/linalg/linalg.c
msgid "tuple index out of range"
msgstr ""
Expand Down Expand Up @@ -3679,6 +3715,10 @@ msgstr ""
msgid "vectors must have same lengths"
msgstr ""

#: ports/esp32s2/common-hal/alarm/pin/__init__.c
msgid "wakeup conflict"
msgstr ""

#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
msgid "watchdog not initialized"
msgstr ""
Expand Down
Loading