comparison src/ui/mfw/mfw_mme.c @ 214:adfdbcd360fd

backlight evolution: API between Condat driver and MFW With this change, the API between the Condat backlight driver and its user in MFW now carries more abstract backlight state codes (fully off, fully on, in call, charging boot mode) instead of 0-255 levels. This change is needed in order to more properly support different hardware targets with different capabilities and approaches in terms of backlight handling.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 23 Apr 2021 23:52:02 +0000
parents 45455ba52f9d
children 3edd1a600218
comparison
equal deleted inserted replaced
213:0947a816580c 214:adfdbcd360fd
166 166
167 static U8 battLevel = 0; /* battery level */ 167 static U8 battLevel = 0; /* battery level */
168 static U8 battState = 0; /* state of power supply */ 168 static U8 battState = 0; /* state of power supply */
169 static U16 hdsPresence = 0; /* headset presence */ 169 static U16 hdsPresence = 0; /* headset presence */
170 170
171 /* backlight control internals */
172 #define LIGHT_LEVEL_OFF 0
173 #define LIGHT_LEVEL_LOW 16
174 #define LIGHT_LEVEL_MAX 255
175
176 UBYTE mme_backlight_incall, mme_backlight_notimer; 171 UBYTE mme_backlight_incall, mme_backlight_notimer;
177 static U8 current_backlight_level; 172 static U8 current_backlight_level;
178 173
179 static MfwHdr bltimIdleH; /* backlight timer for idle state */ 174 static MfwHdr bltimIdleH; /* backlight timer for idle state */
180 static MfwTim bltimIdle; 175 static MfwTim bltimIdle;
460 455
461 void mme_backlightOnEvent (void) 456 void mme_backlightOnEvent (void)
462 { 457 {
463 timStop(&bltimIdleH); 458 timStop(&bltimIdleH);
464 timStop(&bltimCallH); 459 timStop(&bltimCallH);
465 mmeBackLight(LIGHT_LEVEL_MAX); 460 mmeBackLight(LIGHT_STATUS_ON);
466 if (mme_backlight_notimer) 461 if (mme_backlight_notimer)
467 return; 462 return;
468 if (mme_backlight_incall) 463 if (mme_backlight_incall)
469 timStart(&bltimCallH); 464 timStart(&bltimCallH);
470 else 465 else
473 468
474 int mme_backlightKeyPress (void) 469 int mme_backlightKeyPress (void)
475 { 470 {
476 int ret; 471 int ret;
477 472
478 ret = (current_backlight_level == LIGHT_LEVEL_OFF); 473 ret = (current_backlight_level == LIGHT_STATUS_OFF);
479 timStop(&bltimIdleH); 474 timStop(&bltimIdleH);
480 timStop(&bltimCallH); 475 timStop(&bltimCallH);
481 mmeBackLight(LIGHT_LEVEL_MAX); 476 mmeBackLight(LIGHT_STATUS_ON);
482 return ret; 477 return ret;
483 } 478 }
484 479
485 static int bl_timeout_idle (U32 t, void *h) 480 static int bl_timeout_idle (U32 t, void *h)
486 { 481 {
487 mmeBackLight(LIGHT_LEVEL_OFF); 482 mmeBackLight(LIGHT_STATUS_OFF);
488 } 483 }
489 484
490 static int bl_timeout_call (U32 t, void *h) 485 static int bl_timeout_call (U32 t, void *h)
491 { 486 {
492 mmeBackLight(LIGHT_LEVEL_LOW); 487 mmeBackLight(LIGHT_STATUS_INCALL);
493 } 488 }
494 489
495 490
496 /* 491 /*
497 +--------------------------------------------------------------------+ 492 +--------------------------------------------------------------------+