changeset 198:bb5aba57ecfb

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.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 29 Mar 2021 01:52:48 +0000
parents a963d8cd8682
children b7421cdea22b
files src/condat/com/src/driver/light.c
diffstat 1 files changed, 13 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- 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();
-    }
-}