mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
make backlight code cleaner
This commit is contained in:
parent
bbfd633f35
commit
daa1df9f0f
@ -203,9 +203,9 @@ void display_update(void) {
|
||||
|
||||
int display_backlight(int val)
|
||||
{
|
||||
if (val >= 0 && val <= 255) {
|
||||
if (BACKLIGHT != val && val >= 0 && val <= 255) {
|
||||
BACKLIGHT = val;
|
||||
__HAL_TIM_SetCompare(&TIM1_Handle, TIM_CHANNEL_1, LED_PWM_TIM_PERIOD * BACKLIGHT / 255);
|
||||
}
|
||||
__HAL_TIM_SetCompare(&TIM1_Handle, TIM_CHANNEL_1, LED_PWM_TIM_PERIOD * BACKLIGHT / 255);
|
||||
return BACKLIGHT;
|
||||
}
|
||||
|
@ -128,9 +128,9 @@ int display_orientation(int degrees)
|
||||
|
||||
int display_backlight(int val)
|
||||
{
|
||||
if (val >= 0 && val <= 255) {
|
||||
if (BACKLIGHT != val && val >= 0 && val <= 255) {
|
||||
BACKLIGHT = val;
|
||||
SDL_SetRenderDrawColor(RENDERER, BACKLIGHT, BACKLIGHT, BACKLIGHT, 255);
|
||||
}
|
||||
SDL_SetRenderDrawColor(RENDERER, BACKLIGHT, BACKLIGHT, BACKLIGHT, 255);
|
||||
return BACKLIGHT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user