aboutsummaryrefslogtreecommitdiff
path: root/control/gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'control/gui.c')
-rw-r--r--control/gui.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/control/gui.c b/control/gui.c
new file mode 100644
index 0000000..e70ff87
--- /dev/null
+++ b/control/gui.c
@@ -0,0 +1,58 @@
+#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_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();
+}