comparison src/condat/com/src/driver/light.c @ 72:7bf39f5e834d

backlight control on Luna: switch PWL instead of LEDB This change is preliminary toward upcoming rework of backlight control logic in our UI firmware. LEDB does not exist on Tango-based platforms (it is not brought out on Tango modules), thus turning it on and off produces absolutely no effect beyond making L1 disable deep sleep when LEDB is turned on. However, both iWOW DSK and our upcoming FC Caramel2 boards have a PWL LED, so let's switch that LED on and off to indicate the state of the UI firmware's backlight control. Note that we are NOT switching the actual Luna LCD backlight here, even though it is trivially controlled with a GPIO. The reason for this seemingly strange choice is that we don't want to turn this development board LCD backlight off until we bring the higher-level backlight control logic up to par, including new logic to "swallow" the first keypress that turns on the darkened LCD.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 24 Oct 2020 07:39:54 +0000
parents 4e78acac3d88
children 8697f358f505
comparison
equal deleted inserted replaced
71:1876b5f8d922 72:7bf39f5e834d
54 #include "gdi.h" 54 #include "gdi.h"
55 #include "light.h" 55 #include "light.h"
56 56
57 #endif 57 #endif
58 58
59 #include "main/sys_types.h"
59 #include "fc-target.h" 60 #include "fc-target.h"
61 #include "armio.h"
60 62
61 /*==== EXPORT =====================================================*/ 63 /*==== EXPORT =====================================================*/
62 64
63 /*==== VARIABLES ==================================================*/ 65 /*==== VARIABLES ==================================================*/
64 UBYTE backlight_status = LIGHT_STATUS_OFF; 66 UBYTE backlight_status = LIGHT_STATUS_OFF;
95 97
96 GLOBAL UBYTE light_Init (void) 98 GLOBAL UBYTE light_Init (void)
97 { 99 {
98 backlight_status = LIGHT_STATUS_OFF; 100 backlight_status = LIGHT_STATUS_OFF;
99 101
102 #ifdef CONFIG_TARGET_LUNA
103 /* PWL module clock enable */
104 *(volatile SYS_UWORD8 *)0xFFFE8001 = 0x01;
105 #endif
106
100 return DRV_OK; 107 return DRV_OK;
101 } 108 }
102 109
103 /* 110 /*
104 +--------------------------------------------------------------------+ 111 +--------------------------------------------------------------------+
140 147
141 switch (in_NewStatus) 148 switch (in_NewStatus)
142 { 149 {
143 case LIGHT_STATUS_OFF: 150 case LIGHT_STATUS_OFF:
144 light_setBacklightOff(); 151 light_setBacklightOff();
145 // Apr 26, 2005 REF : CRR 30627 xpradipg 152 /* ancient code for C-Sample and earlier removed in FreeCalypso */
146 #ifndef FF_MMI_SERVICES_MIGRATION 153 #if 0
147 LT_Disable (); 154 LT_Disable ();
148 #endif 155 #endif
149 break; 156 break;
150 default: 157 default:
151 light_setBacklightOn(); 158 light_setBacklightOn();
152 // Apr 26, 2005 REF : CRR 30627 xpradipg 159 #if 0
153 #ifndef FF_MMI_SERVICES_MIGRATION
154 LT_Enable (); 160 LT_Enable ();
155 LT_Level (255); 161 LT_Level (255);
156 #endif 162 #endif
157 break; 163 break;
158 } 164 }
252 *******************************************************************************/ 258 *******************************************************************************/
253 void light_setBacklightOn( void ) 259 void light_setBacklightOn( void )
254 { 260 {
255 if (backLightState == BACKLIGHT_OFF) 261 if (backLightState == BACKLIGHT_OFF)
256 { 262 {
257 #ifdef CONFIG_TARGET_C139 263 #ifdef CONFIG_TARGET_LUNA
258 AI_SetBit(1); 264 /* turn on PWL */
265 *(volatile SYS_UWORD8 *)0xFFFE8000 = 255;
266 #else
267 #ifdef CONFIG_TARGET_C139
268 AI_SetBit(1);
269 #endif
270 lls_switch_on(LLS_BACKLIGHT); //Switch backlight on
259 #endif 271 #endif
260 //#ifdef DSAMPLE_COLOUR
261 lls_switch_on(LLS_BACKLIGHT); //Switch backlight on
262 //#endif
263 } 272 }
264 backLightState = BACKLIGHT_ON; 273 backLightState = BACKLIGHT_ON;
265 } 274 }
266 /******************************************************************************* 275 /*******************************************************************************
267 276
278 { 287 {
279 if ((backLightState == BACKLIGHT_ON) || 288 if ((backLightState == BACKLIGHT_ON) ||
280 (backLightState == BACKLIGHT_IDLE1)) 289 (backLightState == BACKLIGHT_IDLE1))
281 { 290 {
282 backLightState = BACKLIGHT_OFF; 291 backLightState = BACKLIGHT_OFF;
283 #ifdef CONFIG_TARGET_C139 292 #ifdef CONFIG_TARGET_LUNA
284 AI_ResetBit(1); 293 /* turn off PWL */
294 *(volatile SYS_UWORD8 *)0xFFFE8000 = 0;
295 #else
296 #ifdef CONFIG_TARGET_C139
297 AI_ResetBit(1);
298 #endif
299 lls_switch_off(LLS_BACKLIGHT); //Switch backlight off
285 #endif 300 #endif
286 //#ifdef DSAMPLE_COLOUR
287 lls_switch_off(LLS_BACKLIGHT); //Switch backlight on
288 //#endif
289 } 301 }
290 } 302 }
291 /******************************************************************************* 303 /*******************************************************************************
292 304
293 $Function: setBacklightIdle 305 $Function: setBacklightIdle