streamlined bootstrap application
This commit is contained in:
parent
6c95119e38
commit
75c5ae71d9
|
@ -7,11 +7,11 @@
|
|||
#include "usb/usbmsc.h"
|
||||
|
||||
|
||||
FATFS FatFs;
|
||||
/**************************************************************************/
|
||||
|
||||
void main_initial(void) {
|
||||
char key=BTN_NONE;
|
||||
|
||||
void init(void)
|
||||
{
|
||||
systickInit(SYSTICKSPEED);
|
||||
|
||||
gpioSetValue (RB_LED0, 0);
|
||||
|
@ -20,57 +20,11 @@ void main_initial(void) {
|
|||
gpioSetValue (RB_LED3, 0);
|
||||
IOCON_PIO1_11 = 0x0;
|
||||
gpioSetDir(RB_LED3, gpioDirection_Output);
|
||||
|
||||
while(1){
|
||||
lcdClear();
|
||||
lcdPrintln("Init v.42");
|
||||
lcdNl();
|
||||
lcdPrintln("Left: ISP()");
|
||||
lcdPrintln("Right: MSC()");
|
||||
lcdPrintln("Up: FormatDF()");
|
||||
lcdPrintln("Down: ???");
|
||||
lcdPrintln("Enter: LEDs()");
|
||||
lcdRefresh();
|
||||
|
||||
key=getInputWait();
|
||||
|
||||
if(key&BTN_ENTER){
|
||||
gpioSetValue (RB_LED0, 1);
|
||||
gpioSetValue (RB_LED1, 1);
|
||||
gpioSetValue (RB_LED2, 1);
|
||||
gpioSetValue (RB_LED3, 1);
|
||||
delayms_power(100);
|
||||
getInputWaitRelease();
|
||||
|
||||
gpioSetValue (RB_LED0, 0);
|
||||
gpioSetValue (RB_LED1, 0);
|
||||
gpioSetValue (RB_LED2, 0);
|
||||
gpioSetValue (RB_LED3, 0);
|
||||
delayms_power(50);
|
||||
};
|
||||
if(key&BTN_RIGHT){
|
||||
lcdClear();
|
||||
lcdPrintln("MSC Enabled.");
|
||||
lcdRefresh();
|
||||
delayms_power(300);
|
||||
usbMSCInit();
|
||||
getInputWait();
|
||||
lcdPrintln("MSC Disabled.");
|
||||
usbMSCOff();
|
||||
lcdRefresh();
|
||||
}
|
||||
if(key&BTN_LEFT){
|
||||
lcdClear();
|
||||
lcdPrintln("Enter ISP!");
|
||||
lcdRefresh();
|
||||
ISPandReset();
|
||||
}
|
||||
if(key&BTN_UP){
|
||||
FATFS FatFs;
|
||||
|
||||
void format(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
lcdClear();
|
||||
|
||||
lcdPrintln("Mount DF:");
|
||||
res=f_mount(0, &FatFs);
|
||||
lcdPrintln(f_get_rc_string(res));
|
||||
|
@ -81,12 +35,32 @@ void main_initial(void) {
|
|||
lcdPrintln(f_get_rc_string(res));
|
||||
lcdRefresh();
|
||||
}
|
||||
if(key&BTN_DOWN){
|
||||
;
|
||||
|
||||
void msc(int timeout)
|
||||
{
|
||||
lcdPrintln("MSC Enabled.");
|
||||
lcdRefresh();
|
||||
delayms_power(300);
|
||||
usbMSCInit();
|
||||
while(timeout--)
|
||||
delayms(1000);
|
||||
lcdPrintln("MSC Disabled.");
|
||||
usbMSCOff();
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
getInputWaitRelease();
|
||||
};
|
||||
void isp(void)
|
||||
{
|
||||
lcdPrintln("Enter ISP!");
|
||||
lcdRefresh();
|
||||
ISPandReset();
|
||||
}
|
||||
|
||||
void main_initial(void) {
|
||||
init();
|
||||
format();
|
||||
msc(10);
|
||||
isp();
|
||||
}
|
||||
|
||||
void tick_initial(void){
|
||||
|
|
Loading…
Reference in New Issue