display.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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_last
  27. } display_strings_t;
  28. typedef struct {
  29. char const * const text[lang_last];
  30. } display_string_t;
  31. static const display_string_t display_strings[str_last] =
  32. {
  33. { // heating
  34. {
  35. "Heizt auf",
  36. "Heating"
  37. }
  38. },
  39. { // heatingready
  40. {
  41. "Bereit (Heizt)",
  42. "Ready (Heating)"
  43. }
  44. },
  45. { // ready
  46. {
  47. "Bereit",
  48. "Ready"
  49. }
  50. },
  51. { // brewing
  52. {
  53. "Bezug..",
  54. "Brewing.."
  55. }
  56. },
  57. { // cleaning
  58. {
  59. "Reinigt..",
  60. "Cleaning.."
  61. }
  62. },
  63. { // error
  64. {
  65. "Fehler",
  66. "Error"
  67. }
  68. },
  69. { // flow
  70. {
  71. "Menge",
  72. "Flow"
  73. }
  74. },
  75. { // bye
  76. {
  77. "Auf wiedersehen",
  78. "Good bye"
  79. }
  80. },
  81. {
  82. {
  83. "Ausschalten...",
  84. "Turning off..."
  85. }
  86. }
  87. };
  88. #define DEFAULT_LANG lang_en /**< Default display language */
  89. #define REFRESH_RATE 10 /**< Display refresh rate in Hz */
  90. #define DISPLAY_ROWS 2
  91. #define DISPLAY_COLS 16
  92. void *displayThread(void *threadid);
  93. void *displayTimerHandler(void *threadid);
  94. void displayInit(void);
  95. void displaySetLang(display_lang_t lang);
  96. void displayPushState(coffee_status_t state);
  97. void displayRefresh(void);
  98. const char* displayGetString(display_strings_t string);
  99. #endif /* DISPLAY_H_ */