diff options
| author | Damien George <damien@micropython.org> | 2021-07-18 12:11:21 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-07-18 23:58:24 +1000 |
| commit | 6823514845c13339efb0e3ff716d2cfa72297d72 (patch) | |
| tree | d9133f52d52f7bea652ef2d792e9aba07e511b4c /ports/esp32/modmachine.c | |
| parent | 59dbbe9be7f91f53f60803559db88cfb75cf1c2a (diff) | |
esp32: Add initial support for ESP32C3 SoCs.
Supported features for this SoC are:
- UART REPL, filesystem
- Pin, ADC, PWM, SoftI2C, SoftSPI, Timer, RTC
- OneWire, DHT, NeoPixel
- RMT
- WiFi, Bluetooth
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/esp32/modmachine.c')
| -rw-r--r-- | ports/esp32/modmachine.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c index aa009944b..50c0cff99 100644 --- a/ports/esp32/modmachine.c +++ b/ports/esp32/modmachine.c @@ -34,7 +34,6 @@ #include "freertos/task.h" #include "esp_sleep.h" #include "esp_pm.h" -#include "driver/touch_pad.h" #if CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/rtc.h" @@ -70,6 +69,10 @@ typedef enum { STATIC bool is_soft_reset = 0; +#if CONFIG_IDF_TARGET_ESP32C3 +int esp_clk_cpu_freq(void); +#endif + STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) { if (n_args == 0) { // get @@ -82,6 +85,8 @@ STATIC mp_obj_t machine_freq(size_t n_args, const mp_obj_t *args) { } #if CONFIG_IDF_TARGET_ESP32 esp_pm_config_esp32_t pm; + #elif CONFIG_IDF_TARGET_ESP32C3 + esp_pm_config_esp32c3_t pm; #elif CONFIG_IDF_TARGET_ESP32S2 esp_pm_config_esp32s2_t pm; #endif @@ -117,6 +122,8 @@ STATIC mp_obj_t machine_sleep_helper(wake_type_t wake_type, size_t n_args, const esp_sleep_enable_timer_wakeup(((uint64_t)expiry) * 1000); } + #if !CONFIG_IDF_TARGET_ESP32C3 + if (machine_rtc_config.ext0_pin != -1 && (machine_rtc_config.ext0_wake_types & wake_type)) { esp_sleep_enable_ext0_wakeup(machine_rtc_config.ext0_pin, machine_rtc_config.ext0_level ? 1 : 0); } @@ -133,6 +140,8 @@ STATIC mp_obj_t machine_sleep_helper(wake_type_t wake_type, size_t n_args, const } } + #endif + switch (wake_type) { case MACHINE_WAKE_SLEEP: esp_light_sleep_start(); |
