display.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 <stdlib.h>
  11. #include <pthread.h>
  12. #include <time.h>
  13. #include <unistd.h>
  14. #include <string.h>
  15. #include "global.h"
  16. #include "logger.h"
  17. #include "database.h"
  18. #include "timer.h"
  19. #include "lcd.h"
  20. #include "coffee.h"
  21. #include "hal.h"
  22. #include "events.h"
  23. typedef enum {
  24. lang_de,
  25. lang_en,
  26. lang_last
  27. } display_lang_t;
  28. typedef enum {
  29. str_heating,
  30. str_heatingready,
  31. str_ready,
  32. str_brewing,
  33. str_cleaning,
  34. str_error,
  35. str_flow,
  36. str_bye,
  37. str_last
  38. } display_strings_t;
  39. typedef struct {
  40. char const * const text[lang_last];
  41. } display_string_t;
  42. static const display_string_t display_strings[str_last] =
  43. {
  44. { // heating
  45. {
  46. "Heizt auf",
  47. "Heating"
  48. }
  49. },
  50. { // heatingready
  51. {
  52. "Bereit (Heizt)",
  53. "Ready (Heating)"
  54. }
  55. },
  56. { // ready
  57. {
  58. "Bereit",
  59. "Ready"
  60. }
  61. },
  62. { // brewing
  63. {
  64. "Bezug..",
  65. "Brewing.."
  66. }
  67. },
  68. { // cleaning
  69. {
  70. "Reinigt..",
  71. "Cleaning.."
  72. }
  73. },
  74. { // error
  75. {
  76. "Fehler",
  77. "Error"
  78. }
  79. },
  80. { // flow
  81. {
  82. "Menge",
  83. "Flow"
  84. }
  85. },
  86. { // bye
  87. {
  88. "Auf wiedersehen",
  89. "Good bye"
  90. }
  91. }
  92. };
  93. #define DEFAULT_LANG lang_en /**< Default display language */
  94. #define REFRESH_RATE 10 /**< Display refresh rate in Hz */
  95. #define DISPLAY_ROWS 2
  96. #define DISPLAY_COLS 16
  97. void *displayThread(void *threadid);
  98. void *displayTimerHandler(void *threadid);
  99. void displayInit(void);
  100. void displaySetLang(display_lang_t lang);
  101. void displayPushState(coffee_status_t state);
  102. void displayRefresh(void);
  103. const char* displayGetString(display_strings_t string);
  104. #endif /* DISPLAY_H_ */