summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-04-18 15:48:39 -0700
committerGitHub <noreply@github.com>2019-04-18 15:48:39 -0700
commitf548305c0722def52cf83c6dc903c2bdae2d1d22 (patch)
tree0db8bcd9ebc59180e1248784ee648bb1e5cb2cfb /shared-module
parent70dd6167c07c5d72ae9b803aa25ccb8f1905ec35 (diff)
parent0113e0970eb7d4b753982692d33754d38694efb7 (diff)
Merge pull request #1815 from dhalbert/stop-flicker
Turn off auto_brightness if brightness is set
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/displayio/Display.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c
index 28df062f8..3b1613974 100644
--- a/shared-module/displayio/Display.c
+++ b/shared-module/displayio/Display.c
@@ -44,7 +44,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart, uint16_t rotation,
uint16_t color_depth, uint8_t set_column_command, 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, bool single_byte_bounds, bool data_as_commands) {
+ const mcu_pin_obj_t* backlight_pin, mp_float_t brightness, bool auto_brightness,
+ bool single_byte_bounds, bool data_as_commands) {
self->color_depth = color_depth;
self->set_column_command = set_column_command;
self->set_row_command = set_row_command;
@@ -53,7 +54,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
self->current_group = NULL;
self->colstart = colstart;
self->rowstart = rowstart;
- self->auto_brightness = false;
+ self->auto_brightness = auto_brightness;
self->data_as_commands = data_as_commands;
self->single_byte_bounds = single_byte_bounds;
@@ -142,6 +143,9 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self,
} else {
self->backlight_pwm.base.type = &pulseio_pwmout_type;
common_hal_pulseio_pwmout_never_reset(&self->backlight_pwm);
+ if (!self->auto_brightness) {
+ common_hal_displayio_display_set_brightness(self, brightness);
+ }
}
}
}