# HG changeset patch # User Mychaela Falconia # Date 1616982768 0 # Node ID bb5aba57ecfbdaff1ade0bfd3cf9aab0de157f3a # Parent a963d8cd8682cdd2c6f42222d871a1f5c2aeb8f8 Condat backlight driver: actually allow switching levels We earlier made a change to this driver allowing different backlight levels to be set. However, the old backlight idle logic prevented switching from one backlight level to another without going through a fully-off state. Now that we have the beginnings of new backlight timer logic in BMI+MFW, the old idle logic in the Condat driver layer can be axed, and we fix that driver layer to allow free switching between different backlight levels. diff -r a963d8cd8682 -r bb5aba57ecfb src/condat/com/src/driver/light.c --- a/src/condat/com/src/driver/light.c Sun Mar 28 23:51:56 2021 +0000 +++ b/src/condat/com/src/driver/light.c Mon Mar 29 01:52:48 2021 +0000 @@ -203,13 +203,6 @@ } } -enum { - BACKLIGHT_OFF, - BACKLIGHT_ON, - BACKLIGHT_IDLE1 -}; -UBYTE backLightState = BACKLIGHT_OFF; - /******************************************************************************* $Function: setBacklightOn @@ -225,20 +218,16 @@ *******************************************************************************/ void light_setBacklightOnLevel (UBYTE level) { - if (backLightState == BACKLIGHT_OFF) - { - #ifdef CONFIG_TARGET_LUNA + #ifdef CONFIG_TARGET_LUNA /* turn on PWL */ *(volatile SYS_UWORD8 *)0xFFFE8000 = level; - #elif defined(CONFIG_TARGET_C139) - AI_SetBit(1); - #endif - if (level & 1) - keypad_bl_on(); - else - keypad_bl_off(); - } - backLightState = BACKLIGHT_ON; + #elif defined(CONFIG_TARGET_C139) + AI_SetBit(1); + #endif + if (level & 1) + keypad_bl_on(); + else + keypad_bl_off(); } /* backward compatibility function */ @@ -260,40 +249,11 @@ *******************************************************************************/ void light_setBacklightOff( void ) { - if ((backLightState == BACKLIGHT_ON) || - (backLightState == BACKLIGHT_IDLE1)) - { - backLightState = BACKLIGHT_OFF; - #ifdef CONFIG_TARGET_LUNA + #ifdef CONFIG_TARGET_LUNA /* turn off PWL */ *(volatile SYS_UWORD8 *)0xFFFE8000 = 0; - #elif defined(CONFIG_TARGET_C139) - AI_ResetBit(1); - #endif - keypad_bl_off(); - } + #elif defined(CONFIG_TARGET_C139) + AI_ResetBit(1); + #endif + keypad_bl_off(); } - -/******************************************************************************* - - $Function: setBacklightIdle - - $Description: switches backlight off (on second call). Called when the 1 minute timer expires. - If no key press since the last call, the backlight is switched off. - - $Returns: none. - - $Arguments: none. - -*******************************************************************************/ -void light_setBacklightIdle( void ) -{ - if (backLightState == BACKLIGHT_ON) - { - backLightState = BACKLIGHT_IDLE1; - } - else - { - light_setBacklightOff(); - } -}