summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-08-18 13:08:33 -0700
committerScott Shawcroft <scott@tannewt.org>2020-08-18 13:08:33 -0700
commit6857f984269149b46d1cd4283506420f341b2601 (patch)
treec37248e39a92eb223b272286c96c68570f797391 /shared-module
parent24ca5c021879221b8935d643c9942515902d6bed (diff)
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because PWMOut is commonly implemented before PulseIn and PulseOut. Fixes #3211
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/displayio/Display.c16
-rw-r--r--shared-module/displayio/Display.h8
-rw-r--r--shared-module/framebufferio/FramebufferDisplay.h1
3 files changed, 12 insertions, 13 deletions
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index 46bb6fdb5..4f92f249f 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -111,14 +111,14 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
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)
- pwmout_result_t result = common_hal_pulseio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false);
+ 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;
common_hal_digitalio_digitalinout_construct(&self->backlight_inout, backlight_pin);
common_hal_never_reset_pin(backlight_pin);
} else {
- self->backlight_pwm.base.type = &pulseio_pwmout_type;
- common_hal_pulseio_pwmout_never_reset(&self->backlight_pwm);
+ self->backlight_pwm.base.type = &pwmio_pwmout_type;
+ common_hal_pwmio_pwmout_never_reset(&self->backlight_pwm);
}
#else
// Otherwise default to digital
@@ -173,14 +173,14 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self,
// Avoid PWM types and functions when the module isn't enabled
#if (CIRCUITPY_PULSEIO)
- bool ispwm = (self->backlight_pwm.base.type == &pulseio_pwmout_type) ? true : false;
+ bool ispwm = (self->backlight_pwm.base.type == &pwmio_pwmout_type) ? true : false;
#else
bool ispwm = false;
#endif
if (ispwm) {
#if (CIRCUITPY_PULSEIO)
- common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness));
+ common_hal_pwmio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness));
ok = true;
#else
ok = false;
@@ -419,9 +419,9 @@ 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 (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
- common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm);
- common_hal_pulseio_pwmout_deinit(&self->backlight_pwm);
+ 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);
} else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) {
common_hal_digitalio_digitalinout_deinit(&self->backlight_inout);
}
diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h
index 861a38fd7..bdb861aa0 100644
--- a/shared-module/displayio/Display.h
+++ b/shared-module/displayio/Display.h
@@ -29,8 +29,8 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/displayio/Group.h"
-#if CIRCUITPY_PULSEIO
-#include "shared-bindings/pulseio/PWMOut.h"
+#if CIRCUITPY_PWMIO
+#include "shared-bindings/pwmio/PWMOut.h"
#endif
#include "shared-module/displayio/area.h"
@@ -41,8 +41,8 @@ typedef struct {
displayio_display_core_t core;
union {
digitalio_digitalinout_obj_t backlight_inout;
- #if CIRCUITPY_PULSEIO
- pulseio_pwmout_obj_t backlight_pwm;
+ #if CIRCUITPY_PWMIO
+ pwmio_pwmout_obj_t backlight_pwm;
#endif
};
uint64_t last_backlight_refresh;
diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h
index 89df0d27c..d73d4b9a9 100644
--- a/shared-module/framebufferio/FramebufferDisplay.h
+++ b/shared-module/framebufferio/FramebufferDisplay.h
@@ -33,7 +33,6 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/displayio/Group.h"
-#include "shared-bindings/pulseio/PWMOut.h"
#include "shared-module/displayio/area.h"
#include "shared-module/displayio/display_core.h"