comparison src/condat/com/src/driver/light.c @ 218:77b980f09bd9

Condat backlight driver switched to use the new R2D on/off API
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 24 Apr 2021 23:47:53 +0000
parents adfdbcd360fd
children
comparison
equal deleted inserted replaced
217:6541e43f88e5 218:77b980f09bd9
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"
60 #include "fc-target.h" 59 #include "fc-target.h"
61 #include "armio.h" 60 #include "r2d/r2d_blrr_api.h"
62 #include "lls/lls_api.h" 61 #include "lls/lls_api.h"
63 62
64 /*==== EXPORT =====================================================*/ 63 /*==== EXPORT =====================================================*/
65 64
66 /*==== VARIABLES ==================================================*/ 65 /*==== VARIABLES ==================================================*/
67 UBYTE backlight_status = LIGHT_STATUS_OFF; 66 UBYTE backlight_status = LIGHT_STATUS_OFF;
68 67
69 /* forward declaration for static functions */ 68 /* forward declaration for static functions */
70 static void keypad_bl_on(void); 69 static void keypad_bl_on(void);
71 static void keypad_bl_off(void); 70 static void keypad_bl_off(void);
72 static void blrr_display_ctrl(UBYTE set_state);
73 71
74 /*==== CONSTANTS ==================================================*/ 72 /*==== CONSTANTS ==================================================*/
75 /* 73 /*
76 +--------------------------------------------------------------------+ 74 +--------------------------------------------------------------------+
77 | PROJECT : GSM-PS (6103) MODULE : DRV_LT | 75 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
88 */ 86 */
89 87
90 GLOBAL UBYTE light_Init (void) 88 GLOBAL UBYTE light_Init (void)
91 { 89 {
92 backlight_status = LIGHT_STATUS_OFF; 90 backlight_status = LIGHT_STATUS_OFF;
93
94 #ifdef CONFIG_TARGET_LUNA
95 /* PWL module clock enable */
96 *(volatile SYS_UWORD8 *)0xFFFE8001 = 0x01;
97 #endif
98 91
99 return DRV_OK; 92 return DRV_OK;
100 } 93 }
101 94
102 /* 95 /*
214 keypad_bl_state = 0; 207 keypad_bl_state = 0;
215 } 208 }
216 } 209 }
217 210
218 #endif 211 #endif
219
220 /*******************************************************************************
221
222 BLRR display (backlight required for readability) on/off control;
223 the plan is to have this control eventually moved to R2D task.
224
225 *******************************************************************************/
226
227 #ifdef CONFIG_TARGET_LUNA
228
229 static void blrr_display_ctrl(UBYTE set_state)
230 {
231 UBYTE on_off;
232
233 /* PWL indication for development */
234 switch (set_state) {
235 case LIGHT_STATUS_OFF:
236 *(volatile SYS_UWORD8 *)0xFFFE8000 = 0;
237 on_off = 0;
238 break;
239 case LIGHT_STATUS_ON:
240 *(volatile SYS_UWORD8 *)0xFFFE8000 = 255;
241 on_off = 1;
242 break;
243 case LIGHT_STATUS_INCALL:
244 *(volatile SYS_UWORD8 *)0xFFFE8000 = 16;
245 on_off = 1;
246 break;
247 case LIGHT_STATUS_CHG_BOOT:
248 *(volatile SYS_UWORD8 *)0xFFFE8000 = 64;
249 on_off = 1;
250 break;
251 default:
252 return; /* error, but we are a void function */
253 }
254 /* physical backlight on/off */
255 if (on_off)
256 AI_SetBit(9);
257 else
258 AI_ResetBit(9);
259 }
260
261 #elif defined(CONFIG_TARGET_C139)
262
263 static void blrr_display_ctrl(UBYTE set_state)
264 {
265 if (set_state != LIGHT_STATUS_OFF)
266 AI_SetBit(1);
267 else
268 AI_ResetBit(1);
269 }
270
271 #else
272
273 static void blrr_display_ctrl(UBYTE set_state)
274 {
275 }
276
277 #endif