#include "core/cmd/cmd.h"
#endif
+#include "fahrplan.h"
#include "init.h"
+#include "ui/browser.h"
#include "ui/display.h"
#include "ui/event.h"
#include "ui/font.h"
#endif
-void usbmode(void) {
- badge_framebuffer fb = { { { 0 } } };
+static void usbmode(void) {
+ badge_event_stop();
- badge_framebuffer_render_text(&fb, 23, 30, "USB-Modus");
+ badge_framebuffer fb = { { { 0 } } };
+ badge_framebuffer_render_text(&fb, 22, 20, "USB-Modus");
+// badge_framebuffer_render_text(&fb, 10, 35, "Reset to exit");
+ badge_framebuffer_render_text(&fb, 16, 35, "Zurück mit");
+ badge_framebuffer_render_text(&fb, 32, 45, "Reset");
/*
badge_framebuffer_render_number(&fb, 23, 50, sizeof(jumpnrun_tile));
badge_framebuffer_render_number(&fb, 33, 50, sizeof(jumpnrun_item));
badge_framebuffer_render_number(&fb, 48, 50, sizeof(jumpnrun_enemy));
*/
- badge_framebuffer_flush(&fb);
- usbMSCInit();
- for(;;);
+ badge_framebuffer_flush(&fb);
+
+ usbMSCInit();
+
+ for(;;) {
+ pmuSleep();
+ }
+}
+
+uint8_t main_menu_show(uint8_t selected) {
+ // first_visible = 0, weil das Menü so kurz ist. Sollte es
+ // größer werden: Parameter aus main_menu empfangen und merken.
+ uint8_t first_visible = 0;
+ char const *const menu[] = {
+ "Titelbild",
+ "Super Hackio",
+ "Fahrplan",
+ "USB-Modus"
+ };
+
+ f_chdir("/");
+ return (uint8_t) badge_menu(menu, ARRAY_SIZE(menu), &first_visible, selected);
}
-void scrolltest(void) {
- badge_browse_textfile("/fahrplan/test.txt");
+void main_menu(void) {
+ uint8_t selected = 0;
+
+ for(;;) {
+ selected = main_menu_show(selected);
+ switch(selected) {
+ case 0: badge_vanity_show(); break;
+ case 1: jumpnrun_play (); break;
+ case 2: badge_fahrplan (); break;
+ case 3: usbmode (); break;
+ }
+ }
}
int main(void)
cpuInit();
systickInit(CFG_SYSTICK_DELAY_IN_MS);
- // pmuInit();
+ pmuInit();
// adcInit();
#ifdef R0KET
rbInit();
FATFS fs;
f_mount(0, &fs);
+#ifdef USBONLY
+ for(;;) usbmode();
+#else
if(badge_input_raw() & BADGE_EVENT_KEY_DOWN) {
usbmode();
}
badge_event_start();
-
- if(badge_input_raw() & BADGE_EVENT_KEY_UP) {
- scrolltest();
- }
-
- if(badge_input_raw() & BADGE_EVENT_KEY_LEFT) {
- badge_vanity_show();
- }
-
- jumpnrun_play();
- usbmode();
+ badge_vanity_show();
+ main_menu();
+#endif
return 0;
}