Wakeup Light with touch user interface, anti-aliased Font, SD card access and RTC usage on STM32F746NG-DISCO board
Dependencies: BSP_DISCO_F746NG_patch_fixed LCD_DISCO_F746NG TS_DISCO_F746NG FATFileSystem TinyJpgDec_interwork mbed-src
UI_Main.cpp@14:2044ad5cd3fe, 2016-02-21 (annotated)
- Committer:
- the_sz
- Date:
- Sun Feb 21 04:26:17 2016 +0000
- Revision:
- 14:2044ad5cd3fe
- Parent:
- 12:a89096944f20
all fonts are working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
the_sz | 3:ecf7f1f8d749 | 1 | #include "WakeupLight.h" |
the_sz | 3:ecf7f1f8d749 | 2 | |
the_sz | 7:dc29f6647486 | 3 | typedef enum |
the_sz | 7:dc29f6647486 | 4 | { |
the_sz | 7:dc29f6647486 | 5 | LUS_CLOCK, |
the_sz | 7:dc29f6647486 | 6 | LUS_CLOCK_IN_WORDS, |
the_sz | 9:fe2c9b3a312b | 7 | LUS_SLIDESHOW, |
the_sz | 7:dc29f6647486 | 8 | |
the_sz | 7:dc29f6647486 | 9 | } LAST_USED_SCREENSAVER_ENUM; |
the_sz | 7:dc29f6647486 | 10 | |
the_sz | 3:ecf7f1f8d749 | 11 | int32_t timeOut; |
the_sz | 7:dc29f6647486 | 12 | LAST_USED_SCREENSAVER_ENUM lastUsedScreensaver=LUS_CLOCK; |
the_sz | 3:ecf7f1f8d749 | 13 | |
the_sz | 5:13c70bcde7f6 | 14 | void UI_MainHandler(UI_REASON_ENUM reason,int32_t index,UI_STRUCT *ui) |
the_sz | 3:ecf7f1f8d749 | 15 | { |
the_sz | 3:ecf7f1f8d749 | 16 | switch (reason) |
the_sz | 3:ecf7f1f8d749 | 17 | { |
the_sz | 3:ecf7f1f8d749 | 18 | case UR_CLICK: |
the_sz | 12:a89096944f20 | 19 | timeOut=RTC_Get(NULL); // actually, this is only needed for LED_... because these will not issue UR_SHOW |
the_sz | 3:ecf7f1f8d749 | 20 | if (index==0) |
the_sz | 7:dc29f6647486 | 21 | { |
the_sz | 7:dc29f6647486 | 22 | lastUsedScreensaver=LUS_CLOCK; |
the_sz | 3:ecf7f1f8d749 | 23 | UI_Show(&uiClock); |
the_sz | 7:dc29f6647486 | 24 | } |
the_sz | 3:ecf7f1f8d749 | 25 | else if (index==1) |
the_sz | 7:dc29f6647486 | 26 | { |
the_sz | 7:dc29f6647486 | 27 | lastUsedScreensaver=LUS_CLOCK_IN_WORDS; |
the_sz | 3:ecf7f1f8d749 | 28 | UI_Show(&uiClockInWords); |
the_sz | 7:dc29f6647486 | 29 | } |
the_sz | 3:ecf7f1f8d749 | 30 | else if (index==2) |
the_sz | 9:fe2c9b3a312b | 31 | { |
the_sz | 9:fe2c9b3a312b | 32 | lastUsedScreensaver=LUS_SLIDESHOW; |
the_sz | 9:fe2c9b3a312b | 33 | UI_Show(&uiSlideshow); |
the_sz | 9:fe2c9b3a312b | 34 | } |
the_sz | 9:fe2c9b3a312b | 35 | else if (index==3) |
the_sz | 7:dc29f6647486 | 36 | UI_WakeupShow(); |
the_sz | 9:fe2c9b3a312b | 37 | else if (index==4) |
the_sz | 12:a89096944f20 | 38 | UI_TimeShow(); |
the_sz | 9:fe2c9b3a312b | 39 | else if (index==5) |
the_sz | 12:a89096944f20 | 40 | LED_StartAnimation(LAE_WAKEUP); |
the_sz | 12:a89096944f20 | 41 | else if (index==6) |
the_sz | 3:ecf7f1f8d749 | 42 | LED_StartAnimation(LAE_OFF); |
the_sz | 12:a89096944f20 | 43 | else if (index==7) |
the_sz | 5:13c70bcde7f6 | 44 | UI_Show(&uiColorTest); |
the_sz | 3:ecf7f1f8d749 | 45 | break; |
the_sz | 3:ecf7f1f8d749 | 46 | |
the_sz | 3:ecf7f1f8d749 | 47 | case UR_TIMER: |
the_sz | 12:a89096944f20 | 48 | if ((RTC_Get(NULL)-timeOut)>10) |
the_sz | 7:dc29f6647486 | 49 | { |
the_sz | 7:dc29f6647486 | 50 | switch (lastUsedScreensaver) |
the_sz | 7:dc29f6647486 | 51 | { |
the_sz | 7:dc29f6647486 | 52 | case LUS_CLOCK: UI_Show(&uiClock); break; |
the_sz | 7:dc29f6647486 | 53 | case LUS_CLOCK_IN_WORDS: UI_Show(&uiClockInWords); break; |
the_sz | 9:fe2c9b3a312b | 54 | case LUS_SLIDESHOW: UI_Show(&uiSlideshow); break; |
the_sz | 7:dc29f6647486 | 55 | } |
the_sz | 7:dc29f6647486 | 56 | } |
the_sz | 3:ecf7f1f8d749 | 57 | break; |
the_sz | 3:ecf7f1f8d749 | 58 | |
the_sz | 3:ecf7f1f8d749 | 59 | case UR_SHOW: |
the_sz | 12:a89096944f20 | 60 | timeOut=RTC_Get(NULL); |
the_sz | 3:ecf7f1f8d749 | 61 | break; |
the_sz | 3:ecf7f1f8d749 | 62 | } |
the_sz | 3:ecf7f1f8d749 | 63 | } |