|
|
|
@ -21,21 +21,20 @@ |
|
|
|
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include <LiquidCrystal_I2C.h> |
|
|
|
|
#include <LiquidMenu.h> |
|
|
|
|
|
|
|
|
|
#ifndef UI_HPP_INCLUDED |
|
|
|
|
#define UI_HPP_INCLUDED |
|
|
|
|
|
|
|
|
|
extern LiquidCrystal_I2C lcd; |
|
|
|
|
#include <LiquidCrystal_I2C.h> |
|
|
|
|
#include <LiquidMenu.h> |
|
|
|
|
#include <Bounce.h> |
|
|
|
|
#include "Encoder4.h" |
|
|
|
|
|
|
|
|
|
extern LiquidCrystal_I2C lcd; |
|
|
|
|
extern Encoder4 enc[2]; |
|
|
|
|
extern Bounce but[2]; |
|
|
|
|
|
|
|
|
|
// Welcome screen
|
|
|
|
|
const char text00[] PROGMEM = "MicroMDAEPiano"; |
|
|
|
|
const char text01[] PROGMEM = "(c)parasiTstudio"; |
|
|
|
|
LiquidLine welcome_line1(1, 0, text00); |
|
|
|
|
LiquidLine welcome_line2(0, 1, text01); |
|
|
|
|
LiquidScreen welcome_screen(welcome_line1, welcome_line2); |
|
|
|
|
// Global vars
|
|
|
|
|
uint8_t main_menu_selector = 0; |
|
|
|
|
|
|
|
|
|
// Main menu
|
|
|
|
|
const char text10[] PROGMEM = "Favorites "; |
|
|
|
@ -44,8 +43,10 @@ const char text12[] PROGMEM = "Store "; |
|
|
|
|
const char text13[] PROGMEM = "Info "; |
|
|
|
|
LiquidLine main_line1(0, 0, text10); |
|
|
|
|
LiquidLine main_line2(0, 1, text11); |
|
|
|
|
LiquidScreen main_screen(main_line1, main_line2); |
|
|
|
|
LiquidMenu main_menu(lcd,welcome_screen,main_screen,1); |
|
|
|
|
LiquidLine main_line3(0, 1, text12); |
|
|
|
|
LiquidLine main_line4(0, 1, text13); |
|
|
|
|
LiquidScreen main_screen; |
|
|
|
|
LiquidMenu main_menu(lcd); |
|
|
|
|
|
|
|
|
|
// Sound menu
|
|
|
|
|
const char text20[] PROGMEM = "Decay "; |
|
|
|
@ -57,27 +58,78 @@ LiquidLine sound_line2(0, 1, text21); |
|
|
|
|
LiquidLine sound_line3(0, 1, text22); |
|
|
|
|
LiquidLine sound_line4(0, 1, text23); |
|
|
|
|
LiquidScreen sound_screen(sound_line1, sound_line2, sound_line3, sound_line4); |
|
|
|
|
LiquidMenu sound_menu(lcd,sound_screen); |
|
|
|
|
LiquidMenu sound_menu(lcd, sound_screen); |
|
|
|
|
|
|
|
|
|
// System menu
|
|
|
|
|
LiquidSystem menu_system(main_menu, sound_menu); |
|
|
|
|
|
|
|
|
|
void callback_main_function() { |
|
|
|
|
Serial.println(F("You called the main callback function.")); |
|
|
|
|
void callback_favorites_function() { |
|
|
|
|
Serial.println(F("callback_favorites_function")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void callback_sound_function() { |
|
|
|
|
Serial.println(F("callback_sound_function")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void callback_store_function() { |
|
|
|
|
Serial.println(F("callback_store_function")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void callback_info_function() { |
|
|
|
|
Serial.println(F("callback_info_function")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void menu_init(void) |
|
|
|
|
{ |
|
|
|
|
uint8_t i; |
|
|
|
|
|
|
|
|
|
// LCD display setup
|
|
|
|
|
lcd.init(); |
|
|
|
|
lcd.blink_off(); |
|
|
|
|
lcd.cursor_off(); |
|
|
|
|
lcd.backlight(); |
|
|
|
|
lcd.noAutoscroll(); |
|
|
|
|
//lcd.noAutoscroll();
|
|
|
|
|
|
|
|
|
|
main_screen.add_line(main_line1); |
|
|
|
|
main_screen.add_line(main_line2); |
|
|
|
|
main_screen.add_line(main_line3); |
|
|
|
|
main_screen.add_line(main_line4); |
|
|
|
|
|
|
|
|
|
main_line1.attach_function(1, callback_favorites_function); |
|
|
|
|
main_line2.attach_function(2, callback_sound_function); |
|
|
|
|
main_line3.attach_function(3, callback_store_function); |
|
|
|
|
main_line4.attach_function(4, callback_info_function); |
|
|
|
|
|
|
|
|
|
main_screen.set_displayLineCount(2); |
|
|
|
|
main_menu.add_screen(main_screen); |
|
|
|
|
|
|
|
|
|
main_line1.attach_function(1, callback_main_function); |
|
|
|
|
|
|
|
|
|
menu_system.update(); |
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_ENCODER; i++) |
|
|
|
|
but[i].update(); |
|
|
|
|
|
|
|
|
|
enc[1].write(0, 0, 99); |
|
|
|
|
enc[1].write(1, 0, 4); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void handle_ui(void) |
|
|
|
|
{ |
|
|
|
|
uint8_t i; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_ENCODER; i++) |
|
|
|
|
{ |
|
|
|
|
but[i].update(); |
|
|
|
|
|
|
|
|
|
switch (i) |
|
|
|
|
{ |
|
|
|
|
case 1: |
|
|
|
|
if (but[i].risingEdge() || but[i].fallingEdge()) |
|
|
|
|
{ |
|
|
|
|
Serial.println(F("B0")); |
|
|
|
|
main_menu.switch_focus(); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|