A porting of a GPS decoding and presenting program within the mbos RTOS. It is not a definitive application but a study program to test NMEA full decoding library and a first approach to an RTOS. Many thanks to Andrew Levido for his support and his patience on teaching me the RTOS principles from the other side of the Earth. It uses NMEA library by Tim (xtimor@gmail.com) ported by Ken Todotani (http://mbed.org/users/todotani/) on public mbed library (http://mbed.org/users/todotani/programs/GPS_nmeaLib/5yo4h) also available, as original universal C library, on http://nmea.sourceforge.net
Dependencies: mbos Watchdog TextLCD mbed ConfigFile
Task7Dim.cpp@3:a2f9eb3b8a16, 2012-02-03 (annotated)
- Committer:
- guiott
- Date:
- Fri Feb 03 16:29:52 2012 +0000
- Revision:
- 3:a2f9eb3b8a16
- Parent:
- 2:8917036cbf69
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
guiott | 2:8917036cbf69 | 1 | #include "Task7Dim.h" |
guiott | 2:8917036cbf69 | 2 | |
guiott | 2:8917036cbf69 | 3 | void LcdLightDimTask(void) |
guiott | 2:8917036cbf69 | 4 | {/** |
guiott | 2:8917036cbf69 | 5 | *\brief TASK 7, control the LCD backlight intensity to smoothly |
guiott | 2:8917036cbf69 | 6 | switch it on or off |
guiott | 2:8917036cbf69 | 7 | */ |
guiott | 2:8917036cbf69 | 8 | static float LightVal=1; |
guiott | 2:8917036cbf69 | 9 | |
guiott | 2:8917036cbf69 | 10 | while(1) |
guiott | 2:8917036cbf69 | 11 | { |
guiott | 2:8917036cbf69 | 12 | os.WaitEvent(LCD_LIGHT_DIM_ON_EVT | LCD_LIGHT_DIM_OFF_EVT); |
guiott | 2:8917036cbf69 | 13 | if(os.GetEvent()==LCD_LIGHT_DIM_ON_EVT) |
guiott | 2:8917036cbf69 | 14 | { |
guiott | 2:8917036cbf69 | 15 | if(LightVal<1) |
guiott | 2:8917036cbf69 | 16 | { |
guiott | 2:8917036cbf69 | 17 | for (LightVal=0; LightVal<=1; LightVal+=0.01f) |
guiott | 2:8917036cbf69 | 18 | { |
guiott | 2:8917036cbf69 | 19 | LcdBklight=LightVal; |
guiott | 2:8917036cbf69 | 20 | wait_ms(10); |
guiott | 2:8917036cbf69 | 21 | } |
guiott | 2:8917036cbf69 | 22 | } |
guiott | 2:8917036cbf69 | 23 | // Set the timer for the power saving backlight switch off |
guiott | 2:8917036cbf69 | 24 | os.ClearTimer(LCD_LIGHT_DIM_OFF_TMR); |
guiott | 2:8917036cbf69 | 25 | os.SetTimer(LCD_LIGHT_DIM_OFF_TMR, LCD_LIGHT_DIM_TIMER, 0); |
guiott | 2:8917036cbf69 | 26 | } |
guiott | 2:8917036cbf69 | 27 | else if(os.GetEvent()==LCD_LIGHT_DIM_OFF_EVT) |
guiott | 2:8917036cbf69 | 28 | {// The dimming off is slower than lighting up |
guiott | 2:8917036cbf69 | 29 | for (LightVal=1; LightVal>=0; LightVal-=0.01f) |
guiott | 2:8917036cbf69 | 30 | { |
guiott | 2:8917036cbf69 | 31 | LcdBklight=LightVal; |
guiott | 2:8917036cbf69 | 32 | wait_ms(30); |
guiott | 2:8917036cbf69 | 33 | } |
guiott | 2:8917036cbf69 | 34 | } |
guiott | 2:8917036cbf69 | 35 | } |
guiott | 2:8917036cbf69 | 36 | } |