2011-05-22 21:57:54 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
|
|
|
|
#include "lcd/render.h"
|
|
|
|
#include "lcd/backlight.h"
|
|
|
|
#include "lcd/allfonts.h"
|
|
|
|
|
2011-05-25 20:24:53 +00:00
|
|
|
#define BTN_NONE 0
|
|
|
|
#define BTN_UP (1<<0)
|
|
|
|
#define BTN_DOWN (1<<1)
|
|
|
|
#define BTN_LEFT (1<<2)
|
|
|
|
#define BTN_RIGHT (1<<3)
|
|
|
|
#define BTN_ENTER (1<<4)
|
|
|
|
|
2011-05-22 21:57:54 +00:00
|
|
|
void ReinvokeISP(void);
|
|
|
|
|
|
|
|
void incBacklight(void);
|
|
|
|
void decBacklight(void);
|
|
|
|
void gotoISP(void);
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
2011-08-02 11:31:57 +00:00
|
|
|
static const struct MENU mainmenu = {"Mainmenu", {
|
|
|
|
{"Backlight++", &incBacklight},
|
|
|
|
{"Backlight--", &decBacklight},
|
|
|
|
{"Invoke ISP", &gotoISP},
|
|
|
|
{"p1e4", NULL},
|
|
|
|
{"p1e5", NULL},
|
|
|
|
{"p1e6", NULL},
|
|
|
|
{"p1e7", NULL},
|
|
|
|
{"p2e1", NULL},
|
|
|
|
{"p2e2", NULL},
|
|
|
|
{"p2e3", NULL},
|
|
|
|
{NULL, NULL},
|
|
|
|
}};
|
2011-05-22 21:57:54 +00:00
|
|
|
|
2011-05-25 20:24:53 +00:00
|
|
|
|
2011-06-20 21:33:42 +00:00
|
|
|
void main_menutest(void) {
|
2011-05-22 21:57:54 +00:00
|
|
|
|
|
|
|
backlightInit();
|
|
|
|
|
|
|
|
while (1) {
|
2011-07-18 20:09:31 +00:00
|
|
|
lcdDisplay();
|
2011-05-22 21:57:54 +00:00
|
|
|
delayms(10);
|
|
|
|
|
|
|
|
lcdFill(0); // clear display buffer
|
|
|
|
|
|
|
|
font = &Font_Orbitron14pt;
|
|
|
|
|
|
|
|
DoString(0, 0, "Menü");
|
|
|
|
|
2011-05-25 20:24:53 +00:00
|
|
|
if (getInput() == BTN_ENTER) {
|
|
|
|
handleMenu(&mainmenu);
|
2011-05-22 21:57:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void incBacklight(void) {
|
|
|
|
uint32_t brightness = backlightGetBrightness();
|
|
|
|
if (brightness < 100) {
|
|
|
|
backlightSetBrightness(brightness + 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void decBacklight(void) {
|
|
|
|
uint32_t brightness = backlightGetBrightness();
|
|
|
|
if (brightness > 0) {
|
|
|
|
backlightSetBrightness(brightness - 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void gotoISP(void) {
|
|
|
|
DoString(0,58,"Enter ISP!");
|
2011-07-18 20:09:31 +00:00
|
|
|
lcdDisplay();
|
2011-05-22 21:57:54 +00:00
|
|
|
EnableWatchdog(5000);
|
|
|
|
ReinvokeISP();
|
|
|
|
}
|
|
|
|
|