|
|
|
/**
|
|
|
|
* TODO file description
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZAVLAHA_APP_GUI_H
|
|
|
|
#define ZAVLAHA_APP_GUI_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <pico/time.h>
|
|
|
|
#include "gui_event.h"
|
|
|
|
#include "lcd/lcdbuf.h"
|
|
|
|
|
|
|
|
// 🌢🅰🅱🅲🅳❶❷❸❹⊛¤▌↑↓✔
|
|
|
|
|
|
|
|
/// Temporary scratch buffer
|
|
|
|
extern char stmp[100];
|
|
|
|
|
|
|
|
extern struct LcdBuffer lcd;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Screen callback type. The event is either INIT, PAINT, or one of the input events.
|
|
|
|
*/
|
|
|
|
typedef void (*screen_t)(GuiEvent event);
|
|
|
|
|
|
|
|
|
|
|
|
static inline uint32_t timestamp() {
|
|
|
|
return to_ms_since_boot(get_absolute_time());
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Input beep (push or knob turn) */
|
|
|
|
void input_sound_effect();
|
|
|
|
|
|
|
|
|
|
|
|
void gui_loop_iter(GuiEvent message);
|
|
|
|
void gui_init();
|
|
|
|
|
|
|
|
/** Switch to a different screen. Handles initial push state handling (so release
|
|
|
|
* does not cause a "click" event).
|
|
|
|
*
|
|
|
|
* @param pScreen - screen to switch to
|
|
|
|
* @param init - call the INIT event immediately after
|
|
|
|
*/
|
|
|
|
void switch_screen(screen_t pScreen, bool init);
|
|
|
|
|
|
|
|
void request_paint();
|
|
|
|
|
|
|
|
// prototypes for screen handlers
|
|
|
|
|
|
|
|
void screen_home(GuiEvent event);
|
|
|
|
void screen_cyklus(GuiEvent event);
|
|
|
|
void screen_settings(GuiEvent event);
|
|
|
|
// XXX other prototypes
|
|
|
|
|
|
|
|
struct State {
|
|
|
|
/// Repaint was requested from the screen code
|
|
|
|
bool paint_needed;
|
|
|
|
|
|
|
|
/// Pointer to the currently active screen func
|
|
|
|
screen_t screen;
|
|
|
|
|
|
|
|
uint32_t last_tick_time;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct State s_app;
|
|
|
|
|
|
|
|
#endif //ZAVLAHA_APP_GUI_H
|