summaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-09-24 15:01:36 +0530
committerScott Shawcroft <scott@tannewt.org>2020-10-27 16:16:15 -0700
commitda449723df14623647729954dd5427101070d01c (patch)
tree4eac7e1d87782cb24492abb3de45cb70184b164b /ports
parent4d8ffdca8dc570f63c34b8f02856feae2d880688 (diff)
Fix build error
Diffstat (limited to 'ports')
-rw-r--r--ports/esp32s2/common-hal/alarm/__init__.c38
-rw-r--r--ports/esp32s2/common-hal/alarm/__init__.h6
-rw-r--r--ports/esp32s2/supervisor/port.c5
3 files changed, 6 insertions, 43 deletions
diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c
index 90e8e9ecc..89ff6865d 100644
--- a/ports/esp32s2/common-hal/alarm/__init__.c
+++ b/ports/esp32s2/common-hal/alarm/__init__.c
@@ -25,28 +25,11 @@
* THE SOFTWARE.
*/
-#include <sys/time.h>
-
-#include "common-hal/alarm/__init__.h"
#include "shared-bindings/alarm/__init__.h"
+#include "shared-bindings/alarm_io/__init__.h"
+#include "shared-bindings/alarm_time/__init__.h"
#include "esp_sleep.h"
-#include "soc/rtc_periph.h"
-#include "driver/rtc_io.h"
-
-static RTC_DATA_ATTR struct timeval sleep_enter_time;
-static RTC_DATA_ATTR struct timeval sleep_exit_time;
-static RTC_DATA_ATTR uint8_t wake_io;
-
-int common_hal_alarm_get_sleep_time(void) {
- return (sleep_exit_time.tv_sec - sleep_enter_time.tv_sec) * 1000 + (sleep_exit_time.tv_usec - sleep_enter_time.tv_usec) / 1000;
-}
-
-void RTC_IRAM_ATTR esp_wake_deep_sleep(void) {
- esp_default_wake_deep_sleep();
- wake_io = rtc_gpio_get_level(6);
- gettimeofday(&sleep_exit_time, NULL);
-}
mp_obj_t common_hal_alarm_get_wake_alarm(void) {
switch (esp_sleep_get_wakeup_cause()) {
@@ -57,23 +40,12 @@ mp_obj_t common_hal_alarm_get_wake_alarm(void) {
return timer;
case ESP_SLEEP_WAKEUP_EXT0: ;
//Wake up from GPIO
- /*alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t);
+ alarm_io_obj_t *ext0 = m_new_obj(alarm_io_obj_t);
ext0->base.type = &alarm_io_type;
- return ext0;*/
- return mp_obj_new_int(wake_io);
- case ESP_SLEEP_WAKEUP_EXT1:
- //Wake up from GPIO, returns -> esp_sleep_get_ext1_wakeup_status()
- /*uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status();
- if (wakeup_pin_mask != 0) {
- int pin = __builtin_ffsll(wakeup_pin_mask) - 1;
- printf("Wake up from GPIO %d\n", pin);
- } else {
- printf("Wake up from GPIO\n");
- }*/
- break;
+ return ext0;
case ESP_SLEEP_WAKEUP_TOUCHPAD:
//TODO: implement TouchIO
- //Wake up from touch on pad, returns -> esp_sleep_get_touchpad_wakeup_status()
+ //Wake up from touch on pad, esp_sleep_get_touchpad_wakeup_status()
break;
case ESP_SLEEP_WAKEUP_UNDEFINED:
default:
diff --git a/ports/esp32s2/common-hal/alarm/__init__.h b/ports/esp32s2/common-hal/alarm/__init__.h
deleted file mode 100644
index 8ba5e2b04..000000000
--- a/ports/esp32s2/common-hal/alarm/__init__.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H
-#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H
-
-extern void esp_wake_deep_sleep(void);
-
-#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_MICROCONTROLLER_ALARM_H \ No newline at end of file
diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c
index 98c064a8b..840b97963 100644
--- a/ports/esp32s2/supervisor/port.c
+++ b/ports/esp32s2/supervisor/port.c
@@ -34,7 +34,6 @@
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
-#include "common-hal/alarm/__init__.h"
#include "common-hal/analogio/AnalogOut.h"
#include "common-hal/busio/I2C.h"
#include "common-hal/busio/SPI.h"
@@ -87,9 +86,7 @@ safe_mode_t port_init(void) {
if (heap == NULL) {
return NO_HEAP;
}
-
- esp_wake_deep_sleep();
-
+
return NO_SAFE_MODE;
}