//# MENU usb_storage void msc_menu(void){ lcdClear(); lcdPrintln("MSC Enabled."); lcdRefresh(); usbMSCInit(); while(!getInputRaw())delayms(10); DoString(0,16,"MSC Disabled."); usbMSCOff(); fsReInit(); };
void main(void) { // Configure cpu and mandatory peripherals cpuInit(); // Configure the CPU // we do it later // systickInit(CFG_SYSTICK_DELAY_IN_MS); // Start systick timer // cpuInit already calls this // gpioInit(); // Enable GPIO pmuInit(); // Configure power management adcInit(); // Config adc pins to save power // initialise basic badge functions rbInit(); initUUID(); // Cache UUID values. lcdInit(); // display lcdFill(0); lcdDisplay(); switch(getInputRaw()){ case BTN_ENTER: lcdPrint("ISP active"); lcdRefresh(); ReinvokeISP(); break; case BTN_DOWN: lcdPrint("MSC active"); lcdRefresh(); usbMSCInit(); while(1); break; }; fsInit(); if( getInputRaw() == BTN_UP ){ // Reset config saveConfig(); } wrapper(); // see applications/ subdirectory }
static void usbmode(void) { badge_event_stop(); 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(;;) { // pmuSleep(); } }
void fsInit(){ FRESULT i; DIR dir; /* Directory object */ f_mount(0, &FatFs); i = f_opendir(&dir, "0:"); if( i == FR_NO_FILESYSTEM ){ lcdPrintln("filesystm b0rk"); lcdPrintln("Formating..."); lcdRefresh(); format_formatDF(); lcdPrintln("Done."); lcdPrintln("Now copy files"); lcdPrintln("to drive. See"); lcdPrintln(""); lcdPrintln("r0ket.de/init"); lcdRefresh(); usbMSCInit(); while(1); } };