You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.2 KiB
64 lines
1.2 KiB
2 years ago
|
/**
|
||
|
* 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);
|
||
|
// 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
|