display.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * display.h
  3. *
  4. * Created on: Sep 26, 2017
  5. * Author: Philipp Hinz
  6. */
  7. #ifndef DISPLAY_H_
  8. #define DISPLAY_H_
  9. #include <string>
  10. #include "coffee.h"
  11. typedef enum {
  12. lang_de,
  13. lang_en,
  14. lang_last
  15. } display_lang_t;
  16. typedef enum {
  17. str_heating,
  18. str_heatingready,
  19. str_ready,
  20. str_brewing,
  21. str_cleaning,
  22. str_error,
  23. str_flow,
  24. str_bye,
  25. str_waitoff,
  26. str_menu,
  27. str_menu_softoff,
  28. str_menu_kill,
  29. str_menu_stats,
  30. str_menu_temp,
  31. str_menu_clean,
  32. str_menu_demo,
  33. str_menu_exit,
  34. str_last
  35. } display_strings_t;
  36. typedef struct {
  37. char const * const text[lang_last];
  38. } display_string_t;
  39. static const display_string_t display_strings[str_last] =
  40. {
  41. { // heating
  42. {
  43. "Heizt auf",
  44. "Heating"
  45. }
  46. },
  47. { // heatingready
  48. {
  49. "Bereit (Heizt)",
  50. "Ready (Heating)"
  51. }
  52. },
  53. { // ready
  54. {
  55. "Bereit",
  56. "Ready"
  57. }
  58. },
  59. { // brewing
  60. {
  61. "Bezug..",
  62. "Brewing.."
  63. }
  64. },
  65. { // cleaning
  66. {
  67. "Reinigt..",
  68. "Cleaning.."
  69. }
  70. },
  71. { // error
  72. {
  73. "Fehler",
  74. "Error"
  75. }
  76. },
  77. { // flow
  78. {
  79. "Menge",
  80. "Flow"
  81. }
  82. },
  83. { // bye
  84. {
  85. "Auf wiedersehen",
  86. "Good bye"
  87. }
  88. },
  89. { // waitoff
  90. {
  91. "Ausschalten...",
  92. "Turning off..."
  93. }
  94. },
  95. { // str_menu
  96. {
  97. "CoffeePi Menü",
  98. "CoffeePi Menu"
  99. }
  100. },
  101. { // str_menu_softoff
  102. {
  103. "Ausschalten",
  104. "Turn off"
  105. }
  106. },
  107. { // str_menu_kill
  108. {
  109. "Sofort ausschalten",
  110. "Turn off now"
  111. }
  112. },
  113. { // str_menu_stats
  114. {
  115. "Stats",
  116. "Stats"
  117. }
  118. },
  119. { // str_menu_temp
  120. {
  121. "Temperatur",
  122. "Temperature"
  123. }
  124. },
  125. { // str_menu_clean
  126. {
  127. "Reinigen",
  128. "Clean"
  129. }
  130. },
  131. { // str_menu_demo
  132. {
  133. "Demo",
  134. "Demo"
  135. }
  136. },
  137. { // str_menu_exit
  138. {
  139. "Menü verlassen",
  140. "Leave menu"
  141. }
  142. }
  143. };
  144. #define DEFAULT_LANG lang_en /**< Default display language */
  145. #define REFRESH_RATE 5 /**< Display refresh rate in Hz when active */
  146. #define DISPLAY_ROWS 2
  147. #define DISPLAY_COLS 16
  148. void *displayThread(void *threadid);
  149. void *displayTimerHandler(void *threadid);
  150. void displayInit(void);
  151. void displaySetLang(display_lang_t lang);
  152. void displayPushState(coffee_status_t state);
  153. void displayRefresh(void);
  154. const char* displayGetString(display_strings_t string);
  155. #endif /* DISPLAY_H_ */