Skip to content

Commit 3abee9b

Browse files
committed
compiles; maybe ready to test, or almost
1 parent 25591a3 commit 3abee9b

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,19 @@
2626
*/
2727

2828
#include "py/objtuple.h"
29+
#include "py/runtime.h"
2930

3031
#include "shared-bindings/alarm/__init__.h"
3132
#include "shared-bindings/alarm/pin/PinAlarm.h"
3233
#include "shared-bindings/alarm/time/DurationAlarm.h"
34+
#include "shared-bindings/microcontroller/__init__.h"
3335

3436
#include "esp_sleep.h"
3537

3638
STATIC mp_obj_tuple_t *_deep_sleep_alarms;
3739

3840
void alarm_reset(void) {
39-
_deep_sleep_alarms = &mp_const_empty_tuple;
41+
_deep_sleep_alarms = mp_const_empty_tuple;
4042
}
4143

4244
void common_hal_alarm_disable_all(void) {
@@ -94,8 +96,8 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala
9496
}
9597

9698
void common_hal_deep_sleep_with_alarms(void) {
97-
for (size_t i = 0; i < _deep_sleep_alarms.len; i++) {
98-
mp_obj_t alarm = _deep_sleep_alarms.items[i]
99+
for (size_t i = 0; i < _deep_sleep_alarms->len; i++) {
100+
mp_obj_t alarm = _deep_sleep_alarms->items[i];
99101
if (MP_OBJ_IS_TYPE(alarm, &alarm_time_duration_alarm_type)) {
100102
alarm_time_duration_alarm_obj_t *duration_alarm = MP_OBJ_TO_PTR(alarm);
101103
esp_sleep_enable_timer_wakeup(
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2020 Dan Halbert for Adafruit Industries.
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H
28+
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H
29+
30+
void alarm_reset(void);
31+
32+
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "freertos/FreeRTOS.h"
4343

4444
#include "esp_sleep.h"
45+
#include "esp_wifi.h"
4546

4647
void common_hal_mcu_delay_us(uint32_t delay) {
4748
mp_hal_delay_us(delay);

shared-bindings/alarm/__init__.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "py/obj.h"
3131

3232
extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms);
33-
extern mp_obj_t common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms);
33+
extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms);
3434

3535
// Used by wake-up code.
3636
extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm);

0 commit comments

Comments
 (0)