diff options
| author | Jeff Epler <jepler@gmail.com> | 2021-01-09 13:59:54 -0600 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2021-01-09 14:02:47 -0600 |
| commit | e20c65d8f044cb9522cd1a7f4a3030efefa77cbb (patch) | |
| tree | 369c1a0bffa199d715c560a5c9ec42ed814d50d5 /ports | |
| parent | 4735cf4747764f0694e1285085e99f06a7a11a81 (diff) | |
background tasks: Add, use port_wake_main_task
Some ports need an extra operation to ensure that the main task is
awoken so that a queued background task will execute during an ongoing
light sleep.
This removes the need to enable supervisor ticks while I2SOut is operating.
Closes: #3952
Diffstat (limited to 'ports')
| -rw-r--r-- | ports/esp32s2/common-hal/audiobusio/I2SOut.c | 4 | ||||
| -rw-r--r-- | ports/esp32s2/supervisor/port.c | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index ee16c6ca8..86322be86 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -63,8 +63,6 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; - - supervisor_enable_tick(); } bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { @@ -95,8 +93,6 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { port_i2s_reset_instance(self->peripheral.instance); } self->peripheral.instance = -1; - - supervisor_disable_tick(); } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index a5215fdef..6491e7430 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -111,6 +111,12 @@ safe_mode_t port_init(void) { heap = NULL; never_reset_module_internal_pins(); + #if defined(DEBUG) + // debug UART + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif + #if defined(DEBUG) || defined(ENABLE_JTAG) // JTAG common_hal_never_reset_pin(&pin_GPIO39); @@ -291,10 +297,14 @@ void port_disable_tick(void) { esp_timer_stop(_tick_timer); } -void sleep_timer_cb(void* arg) { +void port_wake_main_task() { xTaskNotifyGive(circuitpython_task); } +void sleep_timer_cb(void* arg) { + port_wake_main_task(); +} + void port_interrupt_after_ticks(uint32_t ticks) { uint64_t timeout_us = ticks * 1000000ull / 1024; if (esp_timer_start_once(_sleep_timer, timeout_us) != ESP_OK) { |
