display.h 1.5 KB

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