Skip to content

Commit d7ba641

Browse files
authored
Merge pull request #3767 from dhalbert/sleep
Initial alarm and sleep PR: time alarms with light and deep sleep; PinAlarms not yet implemented
2 parents 5b3c930 + 72fa7d8 commit d7ba641

File tree

77 files changed

+1795
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1795
-126
lines changed

lib/utils/pyexec.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
101101
#endif
102102
}
103103

104-
// If the code was loaded from a file its likely to be running for a while so we'll long
104+
// If the code was loaded from a file it's likely to be running for a while so we'll long
105105
// live it and collect any garbage before running.
106106
if (input_kind == MP_PARSE_FILE_INPUT) {
107107
module_fun = make_obj_long_lived(module_fun, 6);
@@ -132,6 +132,10 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
132132
if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
133133
// at the moment, the value of SystemExit is unused
134134
ret = pyexec_system_exit;
135+
#if CIRCUITPY_ALARM
136+
} else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_DeepSleepRequest)) {
137+
ret = PYEXEC_DEEP_SLEEP;
138+
#endif
135139
} else {
136140
if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
137141
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);

lib/utils/pyexec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ extern int pyexec_system_exit;
4949
#define PYEXEC_FORCED_EXIT (0x100)
5050
#define PYEXEC_SWITCH_MODE (0x200)
5151
#define PYEXEC_EXCEPTION (0x400)
52+
#define PYEXEC_DEEP_SLEEP (0x800)
5253

5354
int pyexec_raw_repl(void);
5455
int pyexec_friendly_repl(void);

locale/circuitpython.pot

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-11-24 15:40-0500\n"
11+
"POT-Creation-Date: 2020-11-27 23:57-0500\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -844,6 +844,10 @@ msgstr ""
844844
msgid "Expected an Address"
845845
msgstr ""
846846

847+
#: shared-bindings/alarm/__init__.c
848+
msgid "Expected an alarm"
849+
msgstr ""
850+
847851
#: shared-module/_pixelbuf/PixelBuf.c
848852
#, c-format
849853
msgid "Expected tuple of length %d, got %d"
@@ -989,6 +993,10 @@ msgstr ""
989993
msgid "I2SOut not available"
990994
msgstr ""
991995

996+
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
997+
msgid "IOs 0, 2 & 4 do not support internal pullup in sleep"
998+
msgstr ""
999+
9921000
#: shared-bindings/aesio/aes.c
9931001
#, c-format
9941002
msgid "IV must be %d bytes long"
@@ -1440,6 +1448,10 @@ msgid ""
14401448
"%d bpp given"
14411449
msgstr ""
14421450

1451+
#: ports/esp32s2/common-hal/alarm/__init__.c
1452+
msgid "Only one alarm.time alarm can be set."
1453+
msgstr ""
1454+
14431455
#: shared-module/displayio/ColorConverter.c
14441456
msgid "Only one color can be transparent at a time"
14451457
msgstr ""
@@ -1497,6 +1509,10 @@ msgstr ""
14971509
msgid "Pin number already reserved by EXTI"
14981510
msgstr ""
14991511

1512+
#: ports/esp32s2/common-hal/alarm/__init__.c
1513+
msgid "PinAlarm not yet implemented"
1514+
msgstr ""
1515+
15001516
#: shared-bindings/rgbmatrix/RGBMatrix.c
15011517
#, c-format
15021518
msgid ""
@@ -1558,7 +1574,7 @@ msgstr ""
15581574
msgid "RTC calibration is not supported on this board"
15591575
msgstr ""
15601576

1561-
#: shared-bindings/time/__init__.c
1577+
#: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c
15621578
msgid "RTC is not supported on this board"
15631579
msgstr ""
15641580

@@ -1704,6 +1720,10 @@ msgstr ""
17041720
msgid "Supply at least one UART pin"
17051721
msgstr ""
17061722

1723+
#: shared-bindings/alarm/time/TimeAlarm.c
1724+
msgid "Supply one of monotonic_time or epoch_time"
1725+
msgstr ""
1726+
17071727
#: shared-bindings/gnss/GNSS.c
17081728
msgid "System entry must be gnss.SatelliteSystem"
17091729
msgstr ""
@@ -1767,6 +1787,10 @@ msgstr ""
17671787
msgid "Tile width must exactly divide bitmap width"
17681788
msgstr ""
17691789

1790+
#: shared-bindings/alarm/time/TimeAlarm.c
1791+
msgid "Time is in the past."
1792+
msgstr ""
1793+
17701794
#: ports/nrf/common-hal/_bleio/Adapter.c
17711795
#, c-format
17721796
msgid "Timeout is too long: Maximum timeout length is %d seconds"
@@ -2481,6 +2505,10 @@ msgstr ""
24812505
msgid "end_x should be an int"
24822506
msgstr ""
24832507

2508+
#: shared-bindings/alarm/time/TimeAlarm.c
2509+
msgid "epoch_time not supported on this board"
2510+
msgstr ""
2511+
24842512
#: ports/nrf/common-hal/busio/UART.c
24852513
#, c-format
24862514
msgid "error = 0x%08lX"
@@ -2850,6 +2878,10 @@ msgstr ""
28502878
msgid "invalid syntax for number"
28512879
msgstr ""
28522880

2881+
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
2882+
msgid "io must be rtc io"
2883+
msgstr ""
2884+
28532885
#: py/objtype.c
28542886
msgid "issubclass() arg 1 must be a class"
28552887
msgstr ""
@@ -3537,6 +3569,10 @@ msgstr ""
35373569
msgid "trapz is defined for 1D arrays of equal length"
35383570
msgstr ""
35393571

3572+
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
3573+
msgid "trigger level must be 0 or 1"
3574+
msgstr ""
3575+
35403576
#: extmod/ulab/code/linalg/linalg.c
35413577
msgid "tuple index out of range"
35423578
msgstr ""
@@ -3679,6 +3715,10 @@ msgstr ""
36793715
msgid "vectors must have same lengths"
36803716
msgstr ""
36813717

3718+
#: ports/esp32s2/common-hal/alarm/pin/__init__.c
3719+
msgid "wakeup conflict"
3720+
msgstr ""
3721+
36823722
#: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c
36833723
msgid "watchdog not initialized"
36843724
msgstr ""

0 commit comments

Comments
 (0)