summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--locale/circuitpython.pot4
-rw-r--r--ports/esp32s2/boards/adafruit_funhouse/board.c2
-rw-r--r--ports/esp32s2/common-hal/pwmio/PWMOut.c6
-rw-r--r--shared-bindings/pwmio/PWMOut.c2
-rw-r--r--shared-module/displayio/Display.c10
5 files changed, 13 insertions, 11 deletions
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 97d46debd..9148569ec 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -753,10 +753,6 @@ msgstr ""
msgid "Could not initialize UART"
msgstr ""
-#: ports/esp32s2/common-hal/pwmio/PWMOut.c
-msgid "Could not initialize timer"
-msgstr ""
-
#: ports/stm/common-hal/pwmio/PWMOut.c
msgid "Could not re-init channel"
msgstr ""
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) {
diff --git a/shared-bindings/pwmio/PWMOut.c b/shared-bindings/pwmio/PWMOut.c
index b70b0c741..01b5bf77a 100644
--- a/shared-bindings/pwmio/PWMOut.c
+++ b/shared-bindings/pwmio/PWMOut.c
@@ -103,6 +103,8 @@ STATIC mp_obj_t pwmio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args,
self->base.type = &pwmio_pwmout_type;
pwmout_result_t result = common_hal_pwmio_pwmout_construct(self, pin, duty_cycle, frequency, variable_frequency);
switch (result) {
+ case PWMOUT_OK:
+ break;
case PWMOUT_INVALID_PIN:
mp_raise_ValueError(translate("Invalid pin"));
break;
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index 63e098e08..9117a50b7 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -111,7 +111,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
self->backlight_inout.base.type = &mp_type_NoneType;
if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) {
// Avoid PWM types and functions when the module isn't enabled
- #if (CIRCUITPY_PULSEIO)
+ #if (CIRCUITPY_PWMIO)
pwmout_result_t result = common_hal_pwmio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false);
if (result != PWMOUT_OK) {
self->backlight_inout.base.type = &digitalio_digitalinout_type;
@@ -173,14 +173,14 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self,
bool ok = false;
// Avoid PWM types and functions when the module isn't enabled
- #if (CIRCUITPY_PULSEIO)
+ #if (CIRCUITPY_PWMIO)
bool ispwm = (self->backlight_pwm.base.type == &pwmio_pwmout_type) ? true : false;
#else
bool ispwm = false;
#endif
if (ispwm) {
- #if (CIRCUITPY_PULSEIO)
+ #if (CIRCUITPY_PWMIO)
common_hal_pwmio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t)(0xffff * brightness));
ok = true;
#else
@@ -410,7 +410,7 @@ STATIC void _update_backlight(displayio_display_obj_t *self) {
if (supervisor_ticks_ms64() - self->last_backlight_refresh < 100) {
return;
}
- // TODO(tannewt): Fade the backlight based on it's existing value and a target value. The target
+ // TODO(tannewt): Fade the backlight based on its existing value and a target value. The target
// should account for ambient light when possible.
common_hal_displayio_display_set_brightness(self, 1.0);
@@ -428,7 +428,7 @@ void displayio_display_background(displayio_display_obj_t *self) {
void release_display(displayio_display_obj_t *self) {
common_hal_displayio_display_set_auto_refresh(self, false);
release_display_core(&self->core);
- #if (CIRCUITPY_PULSEIO)
+ #if (CIRCUITPY_PWMIO)
if (self->backlight_pwm.base.type == &pwmio_pwmout_type) {
common_hal_pwmio_pwmout_reset_ok(&self->backlight_pwm);
common_hal_pwmio_pwmout_deinit(&self->backlight_pwm);