From 308c04b542b784cbc1c058f0733be6890a62ff0c Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Sat, 9 Jul 2011 20:23:39 +0200 Subject: [PATCH] Remove now duplace menu code, to make them compile again --- firmware/applications/fs.c | 100 ------------------------------- firmware/applications/menutest.c | 94 ----------------------------- 2 files changed, 194 deletions(-) diff --git a/firmware/applications/fs.c b/firmware/applications/fs.c index 1c58423..16f8ff1 100644 --- a/firmware/applications/fs.c +++ b/firmware/applications/fs.c @@ -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) { diff --git a/firmware/applications/menutest.c b/firmware/applications/menutest.c index a0ec4ce..5e96c83 100644 --- a/firmware/applications/menutest.c +++ b/firmware/applications/menutest.c @@ -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) {