Remove now duplace menu code, to make them compile again

This commit is contained in:
Stefan `Sec` Zehl 2011-07-09 20:23:39 +02:00
parent 68f69b34ee
commit 308c04b542
2 changed files with 0 additions and 194 deletions

View File

@ -25,18 +25,6 @@ void fs_mount(void);
/**************************************************************************/
struct MENU_DEF {
char *text;
void (*callback)(void);
};
typedef const struct MENU_DEF * menuentry;
struct MENU {
char *title;
menuentry *entries;
};
const struct MENU_DEF menu_incBL = {"Backlight++", &incBacklight};
const struct MENU_DEF menu_decBL = {"Backlight--", &decBacklight};
const struct MENU_DEF menu_ISP = {"Invoke ISP", &gotoISP};
@ -70,8 +58,6 @@ static menuentry menu[] = {
static const struct MENU mainmenu = {"Mainmenu", menu};
void handleMenu(const struct MENU *the_menu) ;
void main_fs(void) {
backlightInit();
@ -91,92 +77,6 @@ void main_fs(void) {
return;
}
void handleMenu(const struct MENU *the_menu) {
uint8_t back = 0;
int8_t menuselection = 0;
uint8_t numentries = 0;
uint8_t visible_lines = 0;
uint8_t current_offset = 0;
if (the_menu == NULL) return;
font = &Font_7x8;
for (numentries = 0; the_menu->entries[numentries] != NULL; numentries++);
visible_lines = RESY/font->u8Height;
if (visible_lines < 2) return;
visible_lines--; // subtract title line
while (!back) {
uint8_t line = 0;
lcdFill(0); // clear display buffer
DoString(0, line, the_menu->title);
line += font->u8Height;
for (uint8_t i = current_offset; i < (visible_lines + current_offset) && i < numentries; i++) {
DoString(14, line, the_menu->entries[i]->text);
if (i == menuselection) {
DoString(0, line, "* ");
}
line += font->u8Height;
}
lcdDisplay(0);
switch (getInput()) {
case BTN_UP:
menuselection--;
if (menuselection < current_offset) {
if (menuselection < 0) {
menuselection = numentries-1;
current_offset = ((numentries-1)/visible_lines) * visible_lines;
} else {
current_offset -= visible_lines;
}
}
break;
case BTN_DOWN:
menuselection++;
if (menuselection > (current_offset + visible_lines-1) || menuselection >= numentries) {
if (menuselection >= numentries) {
menuselection = 0;
current_offset = 0;
} else {
current_offset += visible_lines;
}
}
break;
case BTN_LEFT:
return;
case BTN_RIGHT:
if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback();
break;
case BTN_ENTER:
DoString(0,0,"Called....");
lcdDisplay(0);
lcdFill(0);
if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback();
lcdDisplay(0);
while (getInput()==BTN_NONE) delayms(10);
break;
default:
/* no button pressed */
break;
}
}
return;
}
void incBacklight(void) {
uint32_t brightness = backlightGetBrightness();
if (brightness < 100) {

View File

@ -22,18 +22,6 @@ void gotoISP(void);
/**************************************************************************/
struct MENU_DEF {
char *text;
void (*callback)(void);
};
typedef const struct MENU_DEF * menuentry;
struct MENU {
char *title;
menuentry *entries;
};
const struct MENU_DEF menu_incBL = {"Backlight++", &incBacklight};
const struct MENU_DEF menu_decBL = {"Backlight--", &decBacklight};
const struct MENU_DEF menu_ISP = {"Invoke ISP", &gotoISP};
@ -63,8 +51,6 @@ static menuentry menu[] = {
static const struct MENU mainmenu = {"Mainmenu", menu};
void handleMenu(const struct MENU *the_menu) ;
void main_menutest(void) {
backlightInit();
@ -89,86 +75,6 @@ void main_menutest(void) {
return;
}
void handleMenu(const struct MENU *the_menu) {
uint8_t back = 0;
int8_t menuselection = 0;
uint8_t numentries = 0;
uint8_t visible_lines = 0;
uint8_t current_offset = 0;
if (the_menu == NULL) return;
font = &Font_7x8;
for (numentries = 0; the_menu->entries[numentries] != NULL; numentries++);
visible_lines = RESY/font->u8Height;
if (visible_lines < 2) return;
visible_lines--; // subtract title line
while (!back) {
uint8_t line = 0;
lcdFill(0); // clear display buffer
DoString(0, line, the_menu->title);
line += font->u8Height;
for (uint8_t i = current_offset; i < (visible_lines + current_offset) && i < numentries; i++) {
DoString(14, line, the_menu->entries[i]->text);
if (i == menuselection) {
DoString(0, line, "* ");
}
line += font->u8Height;
}
lcdDisplay(0);
switch (getInput()) {
case BTN_UP:
menuselection--;
if (menuselection < current_offset) {
if (menuselection < 0) {
menuselection = numentries-1;
current_offset = ((numentries-1)/visible_lines) * visible_lines;
} else {
current_offset -= visible_lines;
}
}
break;
case BTN_DOWN:
menuselection++;
if (menuselection > (current_offset + visible_lines-1) || menuselection >= numentries) {
if (menuselection >= numentries) {
menuselection = 0;
current_offset = 0;
} else {
current_offset += visible_lines;
}
}
break;
case BTN_LEFT:
return;
case BTN_RIGHT:
if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback();
break;
case BTN_ENTER:
if (the_menu->entries[menuselection]->callback!=NULL)
the_menu->entries[menuselection]->callback();
break;
default:
/* no button pressed */
break;
}
}
return;
}
void incBacklight(void) {
uint32_t brightness = backlightGetBrightness();
if (brightness < 100) {