Skip to content

Commit da44972

Browse files
microdev1tannewt
authored andcommitted
Fix build error
1 parent 4d8ffdc commit da44972

File tree

9 files changed

+15
-76
lines changed

9 files changed

+15
-76
lines changed

locale/circuitpython.pot

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ msgstr ""
1717
"Content-Type: text/plain; charset=CHARSET\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919

20+
#: main.c
21+
msgid ""
22+
"\n"
23+
"\n"
24+
"------ soft reboot ------\n"
25+
msgstr ""
26+
2027
#: main.c
2128
msgid ""
2229
"\n"
@@ -3303,7 +3310,7 @@ msgstr ""
33033310
msgid "size is defined for ndarrays only"
33043311
msgstr ""
33053312

3306-
#: shared-bindings/time/__init__.c
3313+
#: shared-bindings/alarm_time/__init__.c shared-bindings/time/__init__.c
33073314
msgid "sleep length must be non-negative"
33083315
msgstr ""
33093316

@@ -3319,10 +3326,6 @@ msgstr ""
33193326
msgid "small int overflow"
33203327
msgstr ""
33213328

3322-
#: main.c
3323-
msgid "soft reboot\n"
3324-
msgstr ""
3325-
33263329
#: extmod/ulab/code/numerical/numerical.c
33273330
msgid "sort argument must be an ndarray"
33283331
msgstr ""

ports/esp32s2/common-hal/alarm/__init__.c

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,11 @@
2525
* THE SOFTWARE.
2626
*/
2727

28-
#include <sys/time.h>
29-
30-
#include "common-hal/alarm/__init__.h"
3128
#include "shared-bindings/alarm/__init__.h"
29+
#include "shared-bindings/alarm_io/__init__.h"
30+
#include "shared-bindings/alarm_time/__init__.h"
3231

3332
#include "esp_sleep.h"
34-
#include "soc/rtc_periph.h"
35-
#include "driver/rtc_io.h"
36-
37-
static RTC_DATA_ATTR struct timeval sleep_enter_time;
38-
static RTC_DATA_ATTR struct timeval sleep_exit_time;
39-
static RTC_DATA_ATTR uint8_t wake_io;
40-
41-
int common_hal_alarm_get_sleep_time(void) {
42-
return (sleep_exit_time.tv_sec - sleep_enter_time.tv_sec) * 1000 + (sleep_exit_time.tv_usec - sleep_enter_time.tv_usec) / 1000;
43-
}
44-
45-
void RTC_IRAM_ATTR esp_wake_deep_sleep(void) {
46-
esp_default_wake_deep_sleep();
47-
wake_io = rtc_gpio_get_level(6);
48-
gettimeofday(&sleep_exit_time, NULL);
49-
}
5033

5134
mp_obj_t common_hal_alarm_get_wake_alarm(void) {
5235
switch (esp_sleep_get_wakeup_cause()) {
@@ -57,23 +40,12 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) {
5740
return timer;
5841
case ESP_SLEEP_WAKEUP_EXT0: ;
5942
//Wake up from GPIO
60-
/*alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t);
43+
alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t);
6144
ext0->base.type = &alarm_io_type;
62-
return ext0;*/
63-
return mp_obj_new_int(wake_io);
64-
case ESP_SLEEP_WAKEUP_EXT1:
65-
//Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status()
66-
/*uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status();
67-
if (wakeup_pin_mask != 0) {
68-
int pin = __builtin_ffsll(wakeup_pin_mask) - 1;
69-
printf("Wake up from GPIO %d\n", pin);
70-
} else {
71-
printf("Wake up from GPIO\n");
72-
}*/
73-
break;
45+
return ext0;
7446
case ESP_SLEEP_WAKEUP_TOUCHPAD:
7547
//TODO: implement TouchIO
76-
//Wake up from touch on pad, returns -> esp_sleep_get_touchpad_wakeup_status()
48+
//Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status()
7749
break;
7850
case ESP_SLEEP_WAKEUP_UNDEFINED:
7951
default:

ports/esp32s2/common-hal/alarm/__init__.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

ports/esp32s2/supervisor/port.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "freertos/FreeRTOS.h"
3535
#include "freertos/task.h"
3636

37-
#include "common-hal/alarm/__init__.h"
3837
#include "common-hal/analogio/AnalogOut.h"
3938
#include "common-hal/busio/I2C.h"
4039
#include "common-hal/busio/SPI.h"
@@ -87,9 +86,7 @@ safe_mode_t port_init(void) {
8786
if (heap == NULL) {
8887
return NO_HEAP;
8988
}
90-
91-
esp_wake_deep_sleep();
92-
89+
9390
return NO_SAFE_MODE;
9491
}
9592

py/circuitpy_defns.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ SRC_COMMON_HAL_ALL = \
309309
_pew/__init__.c \
310310
alarm/__init__.c \
311311
alarm_io/__init__.c \
312-
alarm_time/__init__.c \
312+
alarm_time/__init__.c \
313313
analogio/AnalogIn.c \
314314
analogio/AnalogOut.c \
315315
analogio/__init__.c \

shared-bindings/alarm/__init__.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
11
#include "shared-bindings/alarm/__init__.h"
22

3-
//| def getWakeAlarm() -> None:
4-
//| """This returns the alarm that triggered wakeup,
5-
//| also returns alarm specific parameters`.
6-
//|
73
STATIC mp_obj_t alarm_get_wake_alarm(void) {
84
return common_hal_alarm_get_wake_alarm();
95
}
106
STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_wake_alarm_obj, alarm_get_wake_alarm);
117

12-
//| def getSleepTime() -> None:
13-
//| """This returns the period of time in ms,
14-
//| in which the board was in deep sleep`.
15-
//|
16-
STATIC mp_obj_t alarm_get_sleep_time(void) {
17-
return mp_obj_new_int(common_hal_alarm_get_sleep_time());
18-
}
19-
STATIC MP_DEFINE_CONST_FUN_OBJ_0(alarm_get_sleep_time_obj, alarm_get_sleep_time);
20-
218
STATIC const mp_rom_map_elem_t alarm_module_globals_table[] = {
229
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) },
23-
{ MP_ROM_QSTR(MP_QSTR_getSleepTime), MP_ROM_PTR(&alarm_get_sleep_time_obj) },
2410
{ MP_ROM_QSTR(MP_QSTR_getWakeAlarm), MP_ROM_PTR(&alarm_get_wake_alarm_obj) },
2511
};
2612

shared-bindings/alarm/__init__.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33

44
#include "py/obj.h"
55

6-
#include "shared-bindings/alarm_io/__init__.h"
7-
#include "shared-bindings/alarm_time/__init__.h"
8-
9-
extern int common_hal_alarm_get_sleep_time(void);
106
extern mp_obj_t common_hal_alarm_get_wake_alarm(void);
117

128
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM___INIT___H

shared-bindings/alarm_io/__init__.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#include "shared-bindings/alarm_io/__init__.h"
44
#include "shared-bindings/microcontroller/Pin.h"
55

6-
//| Set Pin Wakeup
7-
//|
86
STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
97
enum { ARG_level, ARG_pull };
108
static const mp_arg_t allowed_args[] = {
@@ -27,9 +25,6 @@ STATIC mp_obj_t alarm_io_pin_state(size_t n_args, const mp_obj_t *pos_args, mp_m
2725
}
2826
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(alarm_io_pin_state_obj, 1, alarm_io_pin_state);
2927

30-
31-
//| Disable Pin Wakeup
32-
//|
3328
STATIC mp_obj_t alarm_io_disable(void) {
3429
common_hal_alarm_io_disable();
3530
return mp_const_none;

shared-bindings/alarm_time/__init__.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include "py/obj.h"
22
#include "shared-bindings/alarm_time/__init__.h"
33

4-
//| Set Timer Wakeup
5-
//|
64
STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) {
75
#if MICROPY_PY_BUILTINS_FLOAT
86
mp_float_t seconds = mp_obj_get_float(seconds_o);
@@ -24,8 +22,6 @@ STATIC mp_obj_t alarm_time_duration(mp_obj_t seconds_o) {
2422
}
2523
STATIC MP_DEFINE_CONST_FUN_OBJ_1(alarm_time_duration_obj, alarm_time_duration);
2624

27-
//| Disable Timer Wakeup
28-
//|
2925
STATIC mp_obj_t alarm_time_disable(void) {
3026
common_hal_alarm_time_disable();
3127
return mp_const_none;

0 commit comments

Comments
 (0)