2020-02-14 21:50:57 -05:00
|
|
|
#include "menu_numpad.h"
|
|
|
|
#include "menu_numpad_buttons.h"
|
|
|
|
|
|
|
|
#include <avr/pgmspace.h>
|
|
|
|
|
|
|
|
#include "color_theme.h"
|
2020-04-27 01:43:47 -04:00
|
|
|
#include "menu_np_ql_shared.h"
|
2020-02-14 22:05:12 -05:00
|
|
|
#include "menu_utils.h"
|
2020-02-14 21:50:57 -05:00
|
|
|
#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;
|
|
|
|
|
2020-02-14 22:05:12 -05:00
|
|
|
int16_t numpadMenuSelectedItemRaw = 0;//Allow negative only for easier checks on wrap around
|
|
|
|
|
2020-02-14 21:50:57 -05:00
|
|
|
void drawNumpad(void)
|
|
|
|
{
|
|
|
|
displayFillrect(0,47,320,200,COLOR_BACKGROUND);
|
2020-04-25 22:47:02 -04:00
|
|
|
Button button;
|
|
|
|
Button* bp;
|
|
|
|
for(uint8_t i = 0; i < NUMPAD_MENU_NUM_BUTTONS; ++i){
|
|
|
|
memcpy_P(&bp, &(numpadMenuButtons[i]), sizeof(bp));
|
2020-04-27 00:32:19 -04:00
|
|
|
extractAndDrawButton(&button,bp);
|
2020-04-25 22:47:02 -04:00
|
|
|
}
|
2020-02-14 21:50:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void initNumpad(void)
|
|
|
|
{
|
|
|
|
numpadMenuFrequency = 0;
|
2020-04-27 01:43:47 -04:00
|
|
|
numpadSelectionMode = ButtonPress_e::LongPress;//Anything except NotPressed
|
2020-02-14 21:50:57 -05:00
|
|
|
drawNumpad();
|
2020-02-14 22:05:12 -05:00
|
|
|
initSelector(&numpadMenuSelectedItemRaw,
|
2020-04-25 22:47:02 -04:00
|
|
|
numpadMenuButtons,
|
|
|
|
NUMPAD_MENU_NUM_BUTTONS,
|
2020-02-14 22:05:12 -05:00
|
|
|
MorsePlaybackType_e::PlayChar);
|
2020-02-14 21:50:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuReturn_e runNumpad(const ButtonPress_e tuner_button,
|
|
|
|
const ButtonPress_e touch_button,
|
|
|
|
const Point touch_point,
|
|
|
|
const int16_t knob)
|
|
|
|
{
|
2020-04-27 01:43:47 -04:00
|
|
|
return runNpQlShared(tuner_button,
|
|
|
|
touch_button,
|
|
|
|
touch_point,
|
|
|
|
knob,
|
|
|
|
&numpadMenuSelectedItemRaw,
|
|
|
|
numpadMenuButtons,
|
|
|
|
NUMPAD_MENU_NUM_BUTTONS,
|
|
|
|
&numpadSelectionMode);
|
2020-02-14 21:50:57 -05:00
|
|
|
}
|