Ver código fonte

wip print version

Thomas Buck 7 meses atrás
pai
commit
a4c997e0a5
3 arquivos alterados com 25 adições e 0 exclusões
  1. 1
    0
      include/lcd.h
  2. 7
    0
      src/lcd.c
  3. 17
    0
      src/main.c

+ 1
- 0
include/lcd.h Ver arquivo

@@ -28,6 +28,7 @@ void lcd_init(void);
28 28
 void lcd_draw(const char *mode, const char *val, const char *bat);
29 29
 void lcd_draw_bye(void);
30 30
 void lcd_draw_bitmap(uint8_t *data, int width, int height, int x_off, int y_off);
31
+void lcd_draw_version(void);
31 32
 
32 33
 void lcd_debug_buttons(void);
33 34
 

+ 7
- 0
src/lcd.c Ver arquivo

@@ -135,3 +135,10 @@ void lcd_draw_bye(void) {
135 135
     ssd1306_draw_string(&disp, 8, LCD_HEIGHT / 2 + 5, 3, "loader");
136 136
     ssd1306_show(&disp);
137 137
 }
138
+
139
+void lcd_draw_version(void) {
140
+    ssd1306_clear(&disp);
141
+    // TODO
142
+    ssd1306_draw_string(&disp, 0, LCD_HEIGHT / 2 - 4, 1, "TODO");
143
+    ssd1306_show(&disp);
144
+}

+ 17
- 0
src/main.c Ver arquivo

@@ -100,6 +100,23 @@ int main(void) {
100 100
         lcd_debug_buttons();
101 101
     } else if (debug_buttons[BTN_REC] && (!debug_buttons[BTN_CLICK])) {
102 102
         // skip splash screen
103
+    } else if ((!debug_buttons[BTN_REC]) && debug_buttons[BTN_CLICK]) {
104
+        // show version info
105
+        lcd_draw_version();
106
+
107
+        // wait until button is released
108
+        uint32_t last = to_ms_since_boot(get_absolute_time());
109
+        bool state = false;
110
+        while (debug_buttons[BTN_CLICK]) {
111
+            buttons_run();
112
+            handle_serial_input();
113
+            uint32_t now = to_ms_since_boot(get_absolute_time());
114
+            if ((now - last) >= 250) {
115
+                state = !state;
116
+                led_set(0, state);
117
+            }
118
+        }
119
+        led_set(0, false);
103 120
     } else {
104 121
         // show splash for a bit and animate LEDs
105 122
         for (uint i = 0; i < LED_COUNT; i++) {

Carregando…
Cancelar
Salvar