streamlined bootstrap application

This commit is contained in:
schneider 2011-07-30 11:17:35 +02:00
parent 6c95119e38
commit 75c5ae71d9
1 changed files with 40 additions and 66 deletions

View File

@ -7,11 +7,11 @@
#include "usb/usbmsc.h" #include "usb/usbmsc.h"
FATFS FatFs;
/**************************************************************************/ /**************************************************************************/
void main_initial(void) { void init(void)
char key=BTN_NONE; {
systickInit(SYSTICKSPEED); systickInit(SYSTICKSPEED);
gpioSetValue (RB_LED0, 0); gpioSetValue (RB_LED0, 0);
@ -20,73 +20,47 @@ void main_initial(void) {
gpioSetValue (RB_LED3, 0); gpioSetValue (RB_LED3, 0);
IOCON_PIO1_11 = 0x0; IOCON_PIO1_11 = 0x0;
gpioSetDir(RB_LED3, gpioDirection_Output); gpioSetDir(RB_LED3, gpioDirection_Output);
}
while(1){ void format(void)
lcdClear(); {
lcdPrintln("Init v.42"); int res;
lcdNl(); lcdPrintln("Mount DF:");
lcdPrintln("Left: ISP()"); res=f_mount(0, &FatFs);
lcdPrintln("Right: MSC()"); lcdPrintln(f_get_rc_string(res));
lcdPrintln("Up: FormatDF()"); lcdRefresh();
lcdPrintln("Down: ???");
lcdPrintln("Enter: LEDs()");
lcdRefresh();
key=getInputWait();
if(key&BTN_ENTER){ lcdPrintln("Formatting DF...");
gpioSetValue (RB_LED0, 1); res=f_mkfs(0,1,0);
gpioSetValue (RB_LED1, 1); lcdPrintln(f_get_rc_string(res));
gpioSetValue (RB_LED2, 1); lcdRefresh();
gpioSetValue (RB_LED3, 1); }
delayms_power(100);
getInputWaitRelease();
gpioSetValue (RB_LED0, 0); void msc(int timeout)
gpioSetValue (RB_LED1, 0); {
gpioSetValue (RB_LED2, 0); lcdPrintln("MSC Enabled.");
gpioSetValue (RB_LED3, 0); lcdRefresh();
delayms_power(50); delayms_power(300);
}; usbMSCInit();
if(key&BTN_RIGHT){ while(timeout--)
lcdClear(); delayms(1000);
lcdPrintln("MSC Enabled."); lcdPrintln("MSC Disabled.");
lcdRefresh(); usbMSCOff();
delayms_power(300); lcdRefresh();
usbMSCInit(); }
getInputWait();
lcdPrintln("MSC Disabled.");
usbMSCOff();
lcdRefresh();
}
if(key&BTN_LEFT){
lcdClear();
lcdPrintln("Enter ISP!");
lcdRefresh();
ISPandReset();
}
if(key&BTN_UP){
FATFS FatFs;
int res;
lcdClear(); void isp(void)
{
lcdPrintln("Mount DF:"); lcdPrintln("Enter ISP!");
res=f_mount(0, &FatFs); lcdRefresh();
lcdPrintln(f_get_rc_string(res)); ISPandReset();
lcdRefresh(); }
lcdPrintln("Formatting DF..."); void main_initial(void) {
res=f_mkfs(0,1,0); init();
lcdPrintln(f_get_rc_string(res)); format();
lcdRefresh(); msc(10);
} isp();
if(key&BTN_DOWN){
;
}
getInputWaitRelease();
};
} }
void tick_initial(void){ void tick_initial(void){