diff options
| author | Dan Halbert <halbert@halwitz.org> | 2021-03-19 09:57:21 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2021-03-19 09:57:21 -0400 |
| commit | 1512ca520b3e78ebc5cf6d9e031ac24c9206f1bb (patch) | |
| tree | fc69ba904523ac2a82e65686c9e2dbdd69944b43 /ports/esp32s2 | |
| parent | 8293e1eedc300a5198dd8c20dea61539c3bd8dcc (diff) | |
Fix PWMOut non-error handling and never reset
Diffstat (limited to 'ports/esp32s2')
| -rw-r--r-- | ports/esp32s2/boards/adafruit_funhouse/board.c | 2 | ||||
| -rw-r--r-- | ports/esp32s2/common-hal/pwmio/PWMOut.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ports/esp32s2/boards/adafruit_funhouse/board.c b/ports/esp32s2/boards/adafruit_funhouse/board.c index b1f685d03..810b61dbe 100644 --- a/ports/esp32s2/boards/adafruit_funhouse/board.c +++ b/ports/esp32s2/boards/adafruit_funhouse/board.c @@ -33,6 +33,8 @@ #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" +#include "esp_log.h" + displayio_fourwire_obj_t board_display_obj; #define DELAY 0x80 diff --git a/ports/esp32s2/common-hal/pwmio/PWMOut.c b/ports/esp32s2/common-hal/pwmio/PWMOut.c index 84b2ef658..d662e1dbe 100644 --- a/ports/esp32s2/common-hal/pwmio/PWMOut.c +++ b/ports/esp32s2/common-hal/pwmio/PWMOut.c @@ -92,7 +92,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, } } if (timer_index == INDEX_EMPTY) { - // Running out of timers isn't pin related on ESP32S2 so we can't re-use error messages + // Running out of timers isn't pin related on ESP32S2. return PWMOUT_ALL_TIMERS_IN_USE; } @@ -115,7 +115,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, self->tim_handle.clk_cfg = LEDC_AUTO_CLK; if (ledc_timer_config(&(self->tim_handle)) != ESP_OK) { - mp_raise_ValueError(translate("Could not initialize timer")); + return PWMOUT_INITIALIZATION_ERROR; } self->chan_handle.channel = channel_index; @@ -148,6 +148,8 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, void common_hal_pwmio_pwmout_never_reset(pwmio_pwmout_obj_t *self) { never_reset_tim[self->tim_handle.timer_num] = true; never_reset_chan[self->chan_handle.channel] = true; + + never_reset_pin_number(self->pin_number); } void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) { |
