comparison g23m/condat/com/src/driver/light.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS
4 | Modul : DRV_LT
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Module defines the G23 light emitting driver.
18 +-----------------------------------------------------------------------------
19
20
21 Apr 26, 2005 REF : CRR 30627 xpradipg
22 Bug : Replace the ABB APIs with Audio Service APIs
23 Fix : Remove the LT_ function calls
24 *******************************************************************************/
25 /*
26 June 03, 2005 REF: GSM-ENH-31636 xpradipg
27 Description: Change the board ID for Isample to 71 and add new defination
28 for the CALLISTO with baord ID 70
29 Solution: Add the definition of ALLISTO with board ID 70 and change the
30 board Id to 71 for Isample
31
32 CRR 28825: xpradipg - 11 Feb 2005
33 Description:Extension of GDI-for display of ISample and code cleanup
34 Solution: The code replication for D_Sample and E_sample are removed and a new
35 flag is added for the ISample currently the BOARD ID is set to 60 for ISample.
36
37 */
38 #ifndef DRV_LT_C
39 #define DRV_LT_C
40 #endif
41
42 /*==== INCLUDES ===================================================*/
43 #if defined (NEW_FRAME)
44
45 #include <string.h>
46 #include "typedefs.h"
47 #include "gdi.h"
48 #include "light.h"
49
50 #else
51
52 #include <string.h>
53 #include "stddefs.h"
54 #include "gdi.h"
55 #include "light.h"
56
57 #endif
58 /*==== EXPORT =====================================================*/
59
60 /*==== VARIABLES ==================================================*/
61 UBYTE backlight_status = LIGHT_STATUS_OFF;
62 /*==== FUNCTIONS ==================================================*/
63 #if defined (_TMS470)
64 #ifndef FF_MMI_SERVICES_MIGRATION
65 EXTERN void LT_Disable (void);
66 EXTERN void LT_Enable (void);
67 EXTERN void LT_Level (UBYTE level);
68 #endif
69 #else
70
71 LOCAL void LT_Disable (void);
72 LOCAL void LT_Enable (void);
73 LOCAL void LT_Level (UBYTE level);
74
75 #endif
76
77 /*==== CONSTANTS ==================================================*/
78 /*
79 +--------------------------------------------------------------------+
80 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
81 | STATE : code ROUTINE : light_Init |
82 +--------------------------------------------------------------------+
83
84 PURPOSE : The function initializes the internal data of the driver.
85 The function returns DRV_INITIALIZED if the driver has
86 already been initialized and is ready to be used or is
87 already in use. In case of an initialization failure,
88 i.e. the driver cannot be used, the function returns
89 DRV_INITFAILURE.
90
91 */
92
93 GLOBAL UBYTE light_Init (void)
94 {
95 backlight_status = LIGHT_STATUS_OFF;
96
97 return DRV_OK;
98 }
99
100 /*
101 +--------------------------------------------------------------------+
102 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
103 | STATE : code ROUTINE : light_Exit |
104 +--------------------------------------------------------------------+
105
106 PURPOSE : The function is called when the driver functionality is
107 not longer needed. The function de-allocates the
108 resources.
109
110 */
111
112 GLOBAL void light_Exit (void)
113 {
114 backlight_status = LIGHT_STATUS_OFF;
115 }
116
117 /*
118 +--------------------------------------------------------------------+
119 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
120 | STATE : code ROUTINE : light_SetStatus |
121 +--------------------------------------------------------------------+
122
123 PURPOSE : This function is used to change the status of a specific
124 light emitting device supported by this driver. The device is
125 identified by the parameter in_DeviceID. Depending on
126 the capabilities of the device, the parameter in_NewStatus
127 has different meanings.
128
129 */
130
131 GLOBAL UBYTE light_SetStatus (UBYTE in_DeviceID,
132 UBYTE in_NewStatus)
133 {
134 if (in_DeviceID EQ LIGHT_DEVICE_BACKLIGHT)
135 {
136 backlight_status = in_NewStatus;
137
138 switch (in_NewStatus)
139 {
140 case LIGHT_STATUS_OFF:
141 light_setBacklightOff();
142 // Apr 26, 2005 REF : CRR 30627 xpradipg
143 #ifndef FF_MMI_SERVICES_MIGRATION
144 LT_Disable ();
145 #endif
146 break;
147 default:
148 light_setBacklightOn();
149 // Apr 26, 2005 REF : CRR 30627 xpradipg
150 #ifndef FF_MMI_SERVICES_MIGRATION
151 LT_Enable ();
152 LT_Level (255);
153 #endif
154 break;
155 }
156 return DRV_OK;
157 }
158 else
159 return DRV_INVALID_PARAMS;
160 }
161
162 /*
163 +--------------------------------------------------------------------+
164 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
165 | STATE : code ROUTINE : light_GetStatus |
166 +--------------------------------------------------------------------+
167
168 PURPOSE : This function retrieves the status of a specific light
169 emitting device supported by the driver. If the status
170 of a specified device could be retrieved, the function
171 returns DRV_OK. If the specified device is unknown, the
172 function returns DRV_INVALID_PARAMS.
173
174 */
175
176 GLOBAL UBYTE light_GetStatus (UBYTE in_DeviceID,
177 UBYTE * in_StatusPtr)
178
179 {
180 if (in_DeviceID EQ LIGHT_DEVICE_BACKLIGHT)
181 {
182 *in_StatusPtr = backlight_status;
183 return DRV_OK;
184 }
185 else
186 return DRV_INVALID_PARAMS;
187 }
188
189
190 #if defined (WIN32)
191
192 LOCAL void LT_Disable (void)
193 {
194 }
195
196 LOCAL void LT_Enable (void)
197 {
198 }
199
200 LOCAL void LT_Level (UBYTE level)
201 {
202 }
203
204
205 #endif
206
207 /*******************************************************************************
208
209 Code below added for D-sample backlight
210
211 *******************************************************************************/
212 //June 03, 2005 REF: GSM-ENH-31636 xpradipg
213 //CRR 28825: xpradipg - 11 Feb 2005
214 #if ((BOARD == 40) || (BOARD == 41) || (BOARD == 43) || (BOARD == 70) || (BOARD == 71))
215 #define DSAMPLE_COLOUR
216 #include "lls/lls_api.h"
217 #else
218 /* Procedure stiubs added instead of disabling calls to the procedures. */
219 /* So we will get duplicate procedures if the actual LLS procedures are present */
220 #define LLS_BACKLIGHT 0x02
221 int lls_switch_off(unsigned char equipment)
222 {
223 }
224
225 int lls_switch_on(unsigned char equipment)
226 {
227 }
228
229 #endif
230
231 enum {
232 BACKLIGHT_OFF,
233 BACKLIGHT_ON,
234 BACKLIGHT_IDLE1
235 };
236 UBYTE backLightState= BACKLIGHT_OFF;
237 /*******************************************************************************
238
239 $Function: setBacklightOn
240
241 $Description: switches backlight on. Called on powerup or on a key press.
242 Should also be called on incoming call, SMS etc ?
243
244 $Returns: none.
245
246 $Arguments: none.
247
248
249 *******************************************************************************/
250 void light_setBacklightOn( void )
251 {
252 if (backLightState == BACKLIGHT_OFF)
253 {
254 //#ifdef DSAMPLE_COLOUR
255 lls_switch_on(LLS_BACKLIGHT); //Switch backlight on
256 //#endif
257 }
258 backLightState = BACKLIGHT_ON;
259 }
260 /*******************************************************************************
261
262 $Function: setBacklightOff
263
264 $Description: switches backlight off.
265
266 $Returns: none.
267
268 $Arguments: none.
269
270 *******************************************************************************/
271 void light_setBacklightOff( void )
272 {
273 if ((backLightState == BACKLIGHT_ON) ||
274 (backLightState == BACKLIGHT_IDLE1))
275 {
276 backLightState = BACKLIGHT_OFF;
277 //#ifdef DSAMPLE_COLOUR
278 lls_switch_off(LLS_BACKLIGHT); //Switch backlight on
279 //#endif
280 }
281 }
282 /*******************************************************************************
283
284 $Function: setBacklightIdle
285
286 $Description: switches backlight off (on second call). Called when the 1 minute timer expires.
287 If no key press since the last call, the backlight is switched off.
288
289 $Returns: none.
290
291 $Arguments: none.
292
293 *******************************************************************************/
294 void light_setBacklightIdle( void )
295 {
296 if (backLightState == BACKLIGHT_ON)
297 {
298 backLightState = BACKLIGHT_IDLE1;
299 }
300 else
301 {
302 light_setBacklightOff();
303 }
304 }
305