aboutsummaryrefslogtreecommitdiffstats
path: root/gui.h
blob: d0ec128a34872dafd7000f20aa8687f47fb0d2e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef GUI_H
#define GUI_H

struct button_t {
	uint16_t x0;
	uint16_t y0;
	uint16_t x1;
	uint16_t y1;
	uint32_t *state;
	uint16_t interval;
};

struct bar_t {
	uint16_t x0;
	uint16_t y0;
	uint16_t x1;
	uint16_t y1;
	uint16_t orientation;
	uint16_t frameColor;
	uint16_t bkColor;
	uint16_t valueColor;
	uint16_t interval;
	uint8_t *percent;
};

enum {horizontal, vertical};

#ifdef __cplusplus
extern "C" {
#endif


/*
 * Description: starts main GUI thread which keeps X and Y coordinates of touchpad updated for guiDraw() threads
 *
 * param:
 *		- updateInterval: update interval in milliseconds until next coordinates read-out
 *
 * return: none
 */
void guiInit(uint16_t updateIntervl);

/*
 * Description:	draws button and creates thread which keeps pressed/unpressed state up-to-date
 *
 * param:
 *		- x0, y0, x1, y1: 	coordinates where button gets drawn
 *		- str:				string written centered into button
 *		- fontColor:		color of string
 *		- buttonColor:		color of button
 *		- interval:			interval in ms which updates state
 *		- state:			pointer to variable which keeps state (1 = pressed, 0 = unpressed)
 *
 * return: pointer to created thread
 */
Thread *guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, unsigned char *str, uint16_t fontColor, uint16_t buttonColor, uint16_t inverval, uint8_t *state);

/*
 * Description: draws a bar graph and updates it's value
 *
 * param:
 *		- x0, y0, x1, y1:	coordinates where bar graph gets drawn
 *		- orientation:		horizontal or vertical
 *		- frameColor:		color of the frame
 *		- bkColor:			color of piece inside bar with is not set
 *		- valueColor:		color of value that will be drawn into bar
 *		- interval:			interval in ms which updates percentage
 *		- percent:			pointer value from 0 to 100 percent
 *
 * return : pointer to created thread
 */
Thread *guiDrawBarGraph(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t orientation, uint16_t frameColor, uint16_t bkColor, uint16_t valueColor, uint16_t interval, uint16_t *percent);

#ifdef __cplusplus
}
#endif

#endif