FreeCalypso > hg > fc-tourmaline
changeset 75:8697f358f505
backlight rework: Condat light driver accepts levels
The present change is another intermediate step on the path toward
new FreeCalypso backlight handling. At this intermediate step the
Condat light driver accepts 0-255 backlight levels driven by MFW,
and puts them out on PWL on Luna development boards. At the same
time on C139 it is now possible to turn on the display backlight
with or without the keypad bl - the lsb of the 0-255 backlight level
controls the keypad bl.
MFW presently drives only 0 and 255 backlight levels, thus there is
no visible behavioral change yet - but the plan for subsequent stages
of this backlight rework is to add a dimmed backlight state
(no keypad bl on C139) during active calls.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 24 Oct 2020 20:44:04 +0000 (2020-10-24) |
parents | 03793f41f9bc |
children | 137c6442eb63 |
files | src/condat/com/include/light.h src/condat/com/src/driver/light.c |
diffstat | 2 files changed, 45 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/src/condat/com/include/light.h Sat Oct 24 09:12:01 2020 +0000 +++ b/src/condat/com/include/light.h Sat Oct 24 20:44:04 2020 +0000 @@ -57,8 +57,9 @@ EXTERN UBYTE light_SetStatus (UBYTE in_DeviceID, UBYTE in_NewStatus); EXTERN UBYTE light_GetStatus (UBYTE in_DeviceID, UBYTE * in_StatusPtr); -void light_setBacklightOn( void ); -void light_setBacklightIdle( void ); -void light_setBacklightOff( void ); +void light_setBacklightOn (void); +void light_setBacklightOnLevel (UBYTE level); +void light_setBacklightIdle (void); +void light_setBacklightOff (void); #endif
--- a/src/condat/com/src/driver/light.c Sat Oct 24 09:12:01 2020 +0000 +++ b/src/condat/com/src/driver/light.c Sat Oct 24 20:44:04 2020 +0000 @@ -59,25 +59,12 @@ #include "main/sys_types.h" #include "fc-target.h" #include "armio.h" +#include "lls/lls_api.h" /*==== EXPORT =====================================================*/ /*==== VARIABLES ==================================================*/ UBYTE backlight_status = LIGHT_STATUS_OFF; -/*==== FUNCTIONS ==================================================*/ -#if defined (_TMS470) -#ifndef FF_MMI_SERVICES_MIGRATION -EXTERN void LT_Disable (void); -EXTERN void LT_Enable (void); -EXTERN void LT_Level (UBYTE level); -#endif -#else - -LOCAL void LT_Disable (void); -LOCAL void LT_Enable (void); -LOCAL void LT_Level (UBYTE level); - -#endif /*==== CONSTANTS ==================================================*/ /* @@ -149,17 +136,9 @@ { case LIGHT_STATUS_OFF: light_setBacklightOff(); -/* ancient code for C-Sample and earlier removed in FreeCalypso */ -#if 0 - LT_Disable (); -#endif break; default: - light_setBacklightOn(); -#if 0 - LT_Enable (); - LT_Level (255); -#endif + light_setBacklightOnLevel(backlight_status); break; } return DRV_OK; @@ -196,53 +175,41 @@ } -#if defined (WIN32) - -LOCAL void LT_Disable (void) -{ -} - -LOCAL void LT_Enable (void) -{ -} - -LOCAL void LT_Level (UBYTE level) -{ -} - - -#endif - /******************************************************************************* -Code below added for D-sample backlight +Transitional FreeCalypso backlight driver *******************************************************************************/ -//June 03, 2005 REF: GSM-ENH-31636 xpradipg -//CRR 28825: xpradipg - 11 Feb 2005 -#if ((BOARD == 40) || (BOARD == 41) || (BOARD == 43) || (BOARD == 70) || (BOARD == 71)) -#define DSAMPLE_COLOUR -#include "lls/lls_api.h" -#else -/* Procedure stiubs added instead of disabling calls to the procedures. */ -/* So we will get duplicate procedures if the actual LLS procedures are present */ -#define LLS_BACKLIGHT 0x02 -int lls_switch_off(unsigned char equipment) + +static UBYTE keypad_bl_state; + +static void keypad_bl_on(void) { + if (!keypad_bl_state) { + #if defined(CONFIG_TARGET_C139) || defined(CONFIG_TARGET_PIRELLI) + lls_switch_on(LLS_BACKLIGHT); + #endif + keypad_bl_state = 1; + } } -int lls_switch_on(unsigned char equipment) +static void keypad_bl_off(void) { + if (keypad_bl_state) { + #if defined(CONFIG_TARGET_C139) || defined(CONFIG_TARGET_PIRELLI) + lls_switch_off(LLS_BACKLIGHT); + #endif + keypad_bl_state = 0; + } } -#endif - enum { BACKLIGHT_OFF, BACKLIGHT_ON, BACKLIGHT_IDLE1 }; -UBYTE backLightState= BACKLIGHT_OFF; +UBYTE backLightState = BACKLIGHT_OFF; + /******************************************************************************* $Function: setBacklightOn @@ -256,22 +223,30 @@ *******************************************************************************/ -void light_setBacklightOn( void ) +void light_setBacklightOnLevel (UBYTE level) { if (backLightState == BACKLIGHT_OFF) { #ifdef CONFIG_TARGET_LUNA /* turn on PWL */ - *(volatile SYS_UWORD8 *)0xFFFE8000 = 255; - #else - #ifdef CONFIG_TARGET_C139 - AI_SetBit(1); - #endif - lls_switch_on(LLS_BACKLIGHT); //Switch backlight on + *(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; } + +/* backward compatibility function */ +void light_setBacklightOn( void ) +{ + light_setBacklightOnLevel(255); +} + /******************************************************************************* $Function: setBacklightOff @@ -292,14 +267,13 @@ #ifdef CONFIG_TARGET_LUNA /* turn off PWL */ *(volatile SYS_UWORD8 *)0xFFFE8000 = 0; - #else - #ifdef CONFIG_TARGET_C139 - AI_ResetBit(1); - #endif - lls_switch_off(LLS_BACKLIGHT); //Switch backlight off + #elif defined(CONFIG_TARGET_C139) + AI_ResetBit(1); #endif + keypad_bl_off(); } } + /******************************************************************************* $Function: setBacklightIdle @@ -323,4 +297,3 @@ light_setBacklightOff(); } } -