2019-09-19 14:41:32 +00:00
|
|
|
#ifndef MIDI2CV_UI_H
|
|
|
|
#define MIDI2CV_UI_H
|
|
|
|
|
|
|
|
#include "stmlib/stmlib.h"
|
2019-10-28 17:56:37 +00:00
|
|
|
#include "stmlib/ui/event_queue.h"
|
2019-09-19 14:41:32 +00:00
|
|
|
|
2020-02-23 16:14:07 +00:00
|
|
|
#include "config.h"
|
2020-02-24 23:25:00 +00:00
|
|
|
#include "settings.h"
|
2020-02-23 16:14:07 +00:00
|
|
|
#include "ui/main_menu.h"
|
2020-02-25 20:48:04 +00:00
|
|
|
|
|
|
|
#include "drivers/display.h"
|
2020-02-23 16:14:07 +00:00
|
|
|
|
2019-09-19 14:41:32 +00:00
|
|
|
class UI {
|
2019-10-14 21:51:38 +00:00
|
|
|
public:
|
2020-02-25 20:48:04 +00:00
|
|
|
UI(Part** part_pointers, Display* display, Settings* settings);
|
2019-10-14 21:51:38 +00:00
|
|
|
~UI() {}
|
|
|
|
|
2019-10-28 17:56:37 +00:00
|
|
|
void Poll();
|
2019-10-14 21:51:38 +00:00
|
|
|
void Flush();
|
2020-02-23 01:26:07 +00:00
|
|
|
void DoEvents();
|
2019-10-14 21:51:38 +00:00
|
|
|
|
|
|
|
private:
|
2019-10-28 17:56:37 +00:00
|
|
|
stmlib::EventQueue<16> input_queue;
|
2019-09-19 14:41:32 +00:00
|
|
|
|
2020-02-24 23:25:00 +00:00
|
|
|
Settings* settings;
|
|
|
|
|
2020-02-25 20:48:04 +00:00
|
|
|
Display* display;
|
|
|
|
|
2020-02-21 00:39:20 +00:00
|
|
|
bool long_press_event_sent_;
|
|
|
|
uint32_t start_stop_press_time_;
|
|
|
|
bool encoder_long_press_event_sent_;
|
|
|
|
uint32_t encoder_press_time_;
|
|
|
|
|
2020-02-23 16:14:07 +00:00
|
|
|
MainMenu<PART_COUNT> main_menu;
|
2020-02-24 00:53:33 +00:00
|
|
|
Part** parts;
|
|
|
|
|
|
|
|
void LoadState();
|
|
|
|
void SaveState();
|
2020-02-23 16:14:07 +00:00
|
|
|
|
2019-10-28 17:56:37 +00:00
|
|
|
void Draw();
|
2019-09-19 14:41:32 +00:00
|
|
|
|
2019-10-28 17:56:37 +00:00
|
|
|
void OnClick();
|
|
|
|
void OnLongClick();
|
2020-02-21 00:39:20 +00:00
|
|
|
void OnIncrement(stmlib::Event& e);
|
2019-10-28 17:56:37 +00:00
|
|
|
|
2019-10-14 21:51:38 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(UI);
|
2019-09-19 14:41:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern UI ui;
|
|
|
|
|
|
|
|
#endif
|