gui.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. gui.h
  3. */
  4. #ifndef _GUI_H
  5. #define _GUI_H
  6. #include "menu.h"
  7. #define GUI_ALARM_CNT 4
  8. #define SNOOZE_MINUTES 10
  9. #define ALLOW_SKIP_HOURS 4
  10. struct _gui_data
  11. {
  12. uint16_t week_time; /* calculated: derived from h, mt, mo and weekday */
  13. uint8_t h, mt, mo, st, so; /* input: current time */
  14. uint8_t day; /* input: 1 .. 31 current day in month */
  15. uint8_t month; /* input: 1..12 */
  16. uint8_t year_t, year_o; /* input: current year */
  17. uint8_t weekday; /* calculated: 0 = Monday */
  18. uint8_t next_alarm_index; /* calculated: index for the next alarm or GUI_ALARM_CNT if there is no next alarm */
  19. uint8_t is_skip_possible; /* calculated: whether the next alarm (next_alarm_index) can be skipped */
  20. uint8_t is_alarm; /* input/calculated: set by the software, has to be reset by the user */
  21. uint8_t active_alarm_idx; /* input/calculated: set by the software, has to be reset by the user */
  22. char s[16]; /* string buffer */
  23. };
  24. typedef struct _gui_data gui_data_t;
  25. struct _gui_alarm_struct
  26. {
  27. /* next alarm, all na_ fields are derived from the alarm information */
  28. uint16_t na_week_time_in_minutes;
  29. uint16_t na_minutes_diff; /* calculated: time in minutes until next alarm, 0x0ffff = no alarm */
  30. uint8_t na_h; /* calculated */
  31. uint8_t na_m; /* calculated */
  32. uint8_t na_wd; /* calculated: 0...7, 0=monday, 7=no alarm */
  33. /* alarm information */
  34. uint8_t enable; /* input */
  35. uint8_t snooze_count; /* input */
  36. uint8_t skip_wd; /* input 0 = no skip, 1 = Monday, ...*/
  37. uint8_t h; /* input */
  38. uint8_t m; /* input */
  39. uint8_t wd[7]; /* input: 0 or 1, 0=weekday not selected */
  40. };
  41. typedef struct _gui_alarm_struct gui_alarm_t;
  42. extern const me_t melist_display_time[];
  43. extern const me_t melist_top_menu[];
  44. extern const me_t melist_active_alarm_menu[];
  45. extern const me_t melist_setup_menu[];
  46. extern const me_t melist_alarm_menu[];
  47. extern gui_data_t gui_data;
  48. void gui_Recalculate(void);
  49. void gui_Init(u8g2_t *u8g2);
  50. void gui_Draw(void);
  51. void gui_Next(void);
  52. void gui_Select(void);
  53. #endif