From 0113e0970eb7d4b753982692d33754d38694efb7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 18 Apr 2019 15:59:16 -0400 Subject: add Display.__init__() args for brightness and auto_brightness --- shared-module/displayio/Display.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'shared-module') 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); + } } } } -- cgit v1.2.3