summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2020-11-22 21:52:37 -0500
committerDan Halbert <halbert@halwitz.org>2020-11-22 21:52:37 -0500
commit3abee9b2563f0203f3d9521631499008708bb407 (patch)
treeb637b02b130932650a65759cb3bb6f9e132738e3
parent25591a3f8a28d45157b082fcf8c9ba8a31cbe4f6 (diff)
compiles; maybe ready to test, or almost
-rw-r--r--ports/esp32s2/common-hal/alarm/__init__.c8
-rw-r--r--ports/esp32s2/common-hal/alarm/__init__.h32
-rw-r--r--ports/esp32s2/common-hal/microcontroller/__init__.c1
-rw-r--r--shared-bindings/alarm/__init__.h2
4 files changed, 39 insertions, 4 deletions
diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c
index 4a255c51c..0ea476d86 100644
--- a/ports/esp32s2/common-hal/alarm/__init__.c
+++ b/ports/esp32s2/common-hal/alarm/__init__.c
@@ -26,17 +26,19 @@
*/
#include "py/objtuple.h"
+#include "py/runtime.h"
#include "shared-bindings/alarm/__init__.h"
#include "shared-bindings/alarm/pin/PinAlarm.h"
#include "shared-bindings/alarm/time/DurationAlarm.h"
+#include "shared-bindings/microcontroller/__init__.h"
#include "esp_sleep.h"
STATIC mp_obj_tuple_t *_deep_sleep_alarms;
void alarm_reset(void) {
- _deep_sleep_alarms = &mp_const_empty_tuple;
+ _deep_sleep_alarms = mp_const_empty_tuple;
}
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
}
void common_hal_deep_sleep_with_alarms(void) {
- for (size_t i = 0; i < _deep_sleep_alarms.len; i++) {
- mp_obj_t alarm = _deep_sleep_alarms.items[i]
+ for (size_t i = 0; i < _deep_sleep_alarms->len; i++) {
+ mp_obj_t alarm = _deep_sleep_alarms->items[i];
if (MP_OBJ_IS_TYPE(alarm, &alarm_time_duration_alarm_type)) {
alarm_time_duration_alarm_obj_t *duration_alarm = MP_OBJ_TO_PTR(alarm);
esp_sleep_enable_timer_wakeup(
diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h
new file mode 100644
index 000000000..5678a0e7f
--- /dev/null
+++ b/ports/esp32s2/common-hal/alarm/__init__.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Dan Halbert for Adafruit Industries.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H
+#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H
+
+void alarm_reset(void);
+
+#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_ALARM__INIT__H
diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c
index 9d87e4536..59eb1afcc 100644
--- a/ports/esp32s2/common-hal/microcontroller/__init__.c
+++ b/ports/esp32s2/common-hal/microcontroller/__init__.c
@@ -42,6 +42,7 @@
#include "freertos/FreeRTOS.h"
#include "esp_sleep.h"
+#include "esp_wifi.h"
void common_hal_mcu_delay_us(uint32_t delay) {
mp_hal_delay_us(delay);
diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h
index 4df12175d..c74dfbe5c 100644
--- a/shared-bindings/alarm/__init__.h
+++ b/shared-bindings/alarm/__init__.h
@@ -30,7 +30,7 @@
#include "py/obj.h"
extern mp_obj_t common_hal_alarm_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms);
-extern mp_obj_t common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms);
+extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms);
// Used by wake-up code.
extern void common_hal_alarm_set_wake_alarm(mp_obj_t alarm);