Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbos Watchdog TextLCD mbed ConfigFile
Task7Dim.cpp
00001 #include "Task7Dim.h" 00002 00003 void LcdLightDimTask(void) 00004 {/** 00005 *\brief TASK 7, control the LCD backlight intensity to smoothly 00006 switch it on or off 00007 */ 00008 static float LightVal=1; 00009 00010 while(1) 00011 { 00012 os.WaitEvent(LCD_LIGHT_DIM_ON_EVT | LCD_LIGHT_DIM_OFF_EVT); 00013 if(os.GetEvent()==LCD_LIGHT_DIM_ON_EVT) 00014 { 00015 if(LightVal<1) 00016 { 00017 for (LightVal=0; LightVal<=1; LightVal+=0.01f) 00018 { 00019 LcdBklight=LightVal; 00020 wait_ms(10); 00021 } 00022 } 00023 // Set the timer for the power saving backlight switch off 00024 os.ClearTimer(LCD_LIGHT_DIM_OFF_TMR); 00025 os.SetTimer(LCD_LIGHT_DIM_OFF_TMR, LCD_LIGHT_DIM_TIMER, 0); 00026 } 00027 else if(os.GetEvent()==LCD_LIGHT_DIM_OFF_EVT) 00028 {// The dimming off is slower than lighting up 00029 for (LightVal=1; LightVal>=0; LightVal-=0.01f) 00030 { 00031 LcdBklight=LightVal; 00032 wait_ms(30); 00033 } 00034 } 00035 } 00036 }
Generated on Thu Jul 14 2022 14:06:47 by
1.7.2