Start building out numpad menu

This commit is contained in:
Reed Nightingale 2020-02-14 18:50:57 -08:00
parent 4a0b0ec653
commit d42571f7a5
2 changed files with 55 additions and 0 deletions

53
menu_numpad.cpp Normal file
View File

@ -0,0 +1,53 @@
#include "menu_numpad.h"
#include "menu_numpad_buttons.h"
#include <avr/pgmspace.h>
#include "color_theme.h"
#include "nano_gui.h"
void initNumpad(void);
MenuReturn_e runNumpad(const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,
const int16_t knob);
Menu_t numpad_menu = {
initNumpad,
runNumpad,
nullptr
};
Menu_t *const numpadMenu = &numpad_menu;
void drawNumpad(void)
{
displayFillrect(0,47,320,200,COLOR_BACKGROUND);
Button button;
Button* bp;
for(uint8_t i = 0; i < NUMPAD_MENU_NUM_BUTTONS; ++i){
memcpy_P(&bp, &(numpadMenuButtons[i]), sizeof(bp));
memcpy_P(&button,bp,sizeof(button));
drawButton(&button);
}
}
void initNumpad(void)
{
numpadMenuFrequency = 0;
drawNumpad();
}
MenuReturn_e runNumpad(const ButtonPress_e tuner_button,
const ButtonPress_e touch_button,
const Point touch_point,
const int16_t knob)
{
(void)tuner_button;(void)touch_button;(void)touch_point;(void)knob;//TODO
if(NUMPAD_MENU_EXIT_FREQ == numpadMenuFrequency){
return MenuReturn_e::ExitedRedraw;
}
else{
return MenuReturn_e::StillActive;
}
}

2
menu_numpad.h Normal file
View File

@ -0,0 +1,2 @@
#include "menu.h"
extern Menu_t* const numpadMenu;