Merge pull request #6416 from FoamyGuy/display_brightness_pwm
display brightness pwm 500hz frequency
This commit is contained in:
commit
80ae14202a
@ -111,7 +111,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // not SH1107
|
||||
false, // not SH1107
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -91,7 +91,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // not SH1107
|
||||
false, // not SH1107
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -92,7 +92,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -90,7 +90,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
2, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
true); // SH1107_addressing
|
||||
true, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -144,7 +144,8 @@ void board_init(void) {
|
||||
false, // auto_refresh
|
||||
20, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -114,7 +114,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -114,7 +114,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -101,7 +101,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -118,7 +118,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
500); // backlight_pwm_frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -109,7 +109,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
|
||||
// Enabling the Power of the 40-pin at the back
|
||||
CTR_5V.base.type = &digitalio_digitalinout_type;
|
||||
|
@ -111,7 +111,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -96,7 +96,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // not SH1107
|
||||
false, // not SH1107
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -125,7 +125,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000 // backlight pwm frequency
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
|
||||
|
@ -101,7 +101,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // not SH1107
|
||||
false, // not SH1107
|
||||
50000); // backlight pwm frequency
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000 // backlight pwm frequency
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
|
||||
|
@ -104,7 +104,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // not SH1107
|
||||
false, // not SH1107
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -87,7 +87,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
|
@ -115,7 +115,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
|
||||
|
@ -119,7 +119,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000 // backlight pwm frequency
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
|
||||
|
@ -124,7 +124,8 @@ static void display_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000 // backlight pwm frequency
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO38); // backlight pin
|
||||
|
@ -124,7 +124,8 @@ static void display_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000 // backlight pwm frequency
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO33); // backlight pin
|
||||
|
@ -205,7 +205,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
false, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000 // backlight pwm frequency
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // not SH1107
|
||||
false, // not SH1107
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -92,7 +92,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -92,7 +92,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -91,7 +91,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
false, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -103,7 +103,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
true); // SH1107_addressing
|
||||
true, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -108,7 +108,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
|
@ -111,7 +111,8 @@ void board_init(void) {
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false); // SH1107_addressing
|
||||
false, // SH1107_addressing
|
||||
50000); // backlight pwm frequency
|
||||
|
||||
board_buzz_obj.base.type = &audiopwmio_pwmaudioout_type;
|
||||
common_hal_audiopwmio_pwmaudioout_construct(&board_buzz_obj,
|
||||
|
@ -111,6 +111,7 @@
|
||||
//| :param bool backlight_on_high: If True, pulling the backlight pin high turns the backlight on.
|
||||
//| :param bool SH1107_addressing: Special quirk for SH1107, use upper/lower column set and page set
|
||||
//| :param int set_vertical_scroll: This parameter is accepted but ignored for backwards compatibility. It will be removed in a future release.
|
||||
//| :param int backlight_pwm_frequency: The frequency to use to drive the PWM for backlight brightness control. Default is 50000.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
@ -123,7 +124,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command,
|
||||
ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands,
|
||||
ARG_auto_refresh, ARG_native_frames_per_second, ARG_backlight_on_high,
|
||||
ARG_SH1107_addressing };
|
||||
ARG_SH1107_addressing, ARG_backlight_pwm_frequency };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
@ -151,7 +152,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
{ MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
|
||||
{ MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} },
|
||||
{ MP_QSTR_backlight_on_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} },
|
||||
{ MP_QSTR_SH1107_addressing, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }
|
||||
{ MP_QSTR_SH1107_addressing, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
||||
{ MP_QSTR_backlight_pwm_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 50000} }
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
@ -200,7 +202,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
args[ARG_auto_refresh].u_bool,
|
||||
args[ARG_native_frames_per_second].u_int,
|
||||
args[ARG_backlight_on_high].u_bool,
|
||||
sh1107_addressing
|
||||
sh1107_addressing,
|
||||
args[ARG_backlight_pwm_frequency].u_int
|
||||
);
|
||||
|
||||
return self;
|
||||
|
@ -44,7 +44,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
||||
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 backlight_on_high, bool SH1107_addressing);
|
||||
bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency);
|
||||
|
||||
bool common_hal_displayio_display_show(displayio_display_obj_t *self,
|
||||
displayio_group_t *root_group);
|
||||
|
@ -53,7 +53,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
||||
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 backlight_on_high, bool SH1107_addressing) {
|
||||
bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency) {
|
||||
|
||||
// Turn off auto-refresh as we init.
|
||||
self->auto_refresh = false;
|
||||
@ -116,7 +116,7 @@ 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_PWMIO)
|
||||
pwmout_result_t result = common_hal_pwmio_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, backlight_pwm_frequency, false);
|
||||
if (result != PWMOUT_OK) {
|
||||
self->backlight_inout.base.type = &digitalio_digitalinout_type;
|
||||
common_hal_digitalio_digitalinout_construct(&self->backlight_inout, backlight_pin);
|
||||
|
Loading…
Reference in New Issue
Block a user