aboutsummaryrefslogtreecommitdiff
path: root/control/gui.c
blob: 1ca614209bd94e96eaf9f3888b296c0872d6f19c (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
#include "gui.h"
#include <bcl.h>
#include "state.h"

void update_gui() {
	if (!bc_module_lcd_is_ready())
		return;
	bc_system_pll_enable();
	bc_module_lcd_clear();

	bc_module_lcd_set_font(&bc_font_ubuntu_24);

	int i;
	for (i = 0; i < 24; i++)
		bc_module_lcd_draw_line(0, i, 128, i, true);
	if (enabled)
		bc_module_lcd_draw_string(46, 2, "ON", false);
	else
		bc_module_lcd_draw_string(43, 2, "OFF", false);

	switch (mode) {
		case MODE_SOLID_WARM:
			bc_module_lcd_draw_string(40, 26, "warm", true);
			break;
		case MODE_SOLID_RED:
			bc_module_lcd_draw_string(46, 26, "red", true);
			break;
		case MODE_SOLID_GREEN:
			bc_module_lcd_draw_string(32, 26, "green", true);
			break;
		case MODE_SOLID_BLUE:
			bc_module_lcd_draw_string(40, 26, "blue", true);
			break;
		case MODE_SOLID_YELLOW:
			bc_module_lcd_draw_string(28, 26, "yellow", true);
			break;
		case MODE_RAINBOW:
			bc_module_lcd_draw_string(19, 26, "rainbow", true);
			break;
	}

	for (i = 0; i < (7*brightness); i++)
		bc_module_lcd_draw_line(0, 108-i, 128, 108-i, true);

	bc_module_lcd_set_font(&bc_font_ubuntu_15);
	switch (state) {
		case STATE_COLOR_SELECT:
			bc_module_lcd_draw_string(48, 110, "color", true);
			break;
		case STATE_BRIGHTNESS_SELECT:
			bc_module_lcd_draw_string(31, 110, "brightness", true);
			break;
		case STATE_DEFAULT:
		default:
			// pass
			break;
	}

	bc_module_lcd_update();
	bc_system_pll_disable();
}