CoffeePi Coffee machine control for Raspberry Pi

- Main Page
- Data Structures
- Files

- File List
- Globals

display.h
Go to the documentation of this file.
1 /*
2 * display.h
3 *
4 * Created on: Sep 26, 2017
5 * Author: Philipp Hinz
6 */
7
8 #ifndef DISPLAY_H_
9 #define DISPLAY_H_
10 #include <string>
11
12 typedef enum {
13 lang_de,
14 lang_en,
15 lang_last
16 } display_lang_t;
17
18 typedef enum {
19 str_heating,
20 str_heatingready,
21 str_ready,
22 str_brewing,
23 str_cleaning,
24 str_error,
25 str_flow,
26 str_bye,
27 str_last
28 } display_strings_t;
29
30 typedef struct {
31 char const * const text[lang_last];
32 } display_string_t;
33
34 static const display_string_t display_strings[str_last] =
35 {
36 { // heating
37 {
38 "Heizt auf",
39 "Heating"
40 }
41 },
42 { // heatingready
43 {
44 "Bereit (Heizt)",
45 "Ready (Heating)"
46 }
47 },
48 { // ready
49 {
50 "Bereit",
51 "Ready"
52 }
53 },
54 { // brewing
55 {
56 "Bezug..",
57 "Brewing.."
58 }
59 },
60 { // cleaning
61 {
62 "Reinigt..",
63 "Cleaning.."
64 }
65 },
66 { // error
67 {
68 "Fehler",
69 "Error"
70 }
71 },
72 { // flow
73 {
74 "Menge",
75 "Flow"
76 }
77 },
78 { // bye
79 {
80 "Auf wiedersehen",
81 "Good bye"
82 }
83 }
84 };
85
86 #define DEFAULT_LANG lang_de
87 #define REFRESH_RATE 10
88 #define DISPLAY_ROWS 2
89 #define DISPLAY_COLS 16
90
91 void *displayThread(void *threadid);
92 void *displayTimerHandler(void *threadid);
93 void displayInit(void);
94 void displayTerminate(void);
95 void displaySetLang(display_lang_t lang);
96
97 void displayPushState(int state);
98
99 void displayRefresh(void);
100 const char* displayGetString(display_strings_t string);
101
102
103 #endif /* DISPLAY_H_ */
displayRefresh
void displayRefresh(void)
Refreshed the display content and outputs it.
Definition: display.cpp:198
display_string_t
Definition: display.h:30
displayThread
void * displayThread(void *threadid)
Main thread to handle display data.
Definition: display.cpp:103
lang_en
Definition: display.h:14
displayPushState
void displayPushState(int state)
Updates the display state to the matching coffee state.
Definition: display.cpp:263
str_flow
Definition: display.h:25
display_lang_t
display_lang_t
Definition: display.h:12
str_bye
Definition: display.h:26
str_brewing
Definition: display.h:22
display_strings_t
display_strings_t
Definition: display.h:18
str_cleaning
Definition: display.h:23
displayInit
void displayInit(void)
Initializes display.
Definition: display.cpp:159
displaySetLang
void displaySetLang(display_lang_t lang)
Sets the language of the display text.
Definition: display.cpp:190
displayTimerHandler
void * displayTimerHandler(void *threadid)
Timer handler for display update.
Definition: display.cpp:125
str_ready
Definition: display.h:21
str_last
Definition: display.h:27
str_heatingready
Definition: display.h:20
str_heating
Definition: display.h:19
displayGetString
const char * displayGetString(display_strings_t string)
Returns the matching translation of a string.
Definition: display.cpp:252
str_error
Definition: display.h:24
displayTerminate
void displayTerminate(void)
Handles cleanup before program termination.
Definition: display.cpp:180
lang_de
Definition: display.h:13
lang_last
Definition: display.h:15
state
int state
Definition: coffee.cpp:27