summaryrefslogtreecommitdiff
path: root/shared-module/displayio/Display.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-03-31 15:13:58 -0700
committerScott Shawcroft <scott@tannewt.org>2020-03-31 15:13:58 -0700
commit8fe512c7e95b3bd31348c510780eeb33185741ce (patch)
treeb188c62fb1b0eef23c65484365fcde2893cef5f5 /shared-module/displayio/Display.c
parent4b063aeb29c889809af0758351e68eda48e37f3a (diff)
parentf47b964c5ff838153ebaff2077405b0f4f881565 (diff)
Merge remote-tracking branch 'adafruit/master' into lower_power
Diffstat (limited to 'shared-module/displayio/Display.c')
-rw-r--r--shared-module/displayio/Display.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index add42f599..6af8324ef 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -48,7 +48,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll,
uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin,
uint16_t brightness_command, mp_float_t brightness, bool auto_brightness,
- bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second) {
+ bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, bool backlight_on_high) {
// Turn off auto-refresh as we init.
self->auto_refresh = false;
uint16_t ram_width = 0x100;
@@ -157,6 +157,9 @@ mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t*
bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness) {
self->updating_backlight = true;
+ if (!self->backlight_on_high){
+ brightness = 1.0-brightness;
+ }
bool ok = false;
if (self->backlight_pwm.base.type == &pulseio_pwmout_type) {
common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness));