Impement "enter==ISP" on bootup as discussed

This commit is contained in:
Stefan `Sec` Zehl 2011-07-04 22:49:35 +02:00
parent 651a6b4d48
commit 52d4a93fc7
3 changed files with 32 additions and 0 deletions

View File

@ -5,6 +5,11 @@
void main_default(void) { void main_default(void) {
systickInit(10); systickInit(10);
if(getInputRaw()==BTN_ENTER){
ISPandReset(7);
};
return; return;
}; };

View File

@ -138,6 +138,7 @@ uint32_t GetVoltage(void);
#define BTN_RIGHT (1<<3) #define BTN_RIGHT (1<<3)
#define BTN_ENTER (1<<4) #define BTN_ENTER (1<<4)
uint8_t getInput(void); uint8_t getInput(void);
uint8_t getInputRaw(void);
//uuid.c //uuid.c
uint32_t GetUUID32(void); uint32_t GetUUID32(void);

View File

@ -36,3 +36,29 @@ uint8_t getInput(void) {
return result; return result;
} }
uint8_t getInputRaw(void) {
uint8_t result = BTN_NONE;
if (gpioGetValue(RB_BTN3)==0) {
result += BTN_UP;
}
if (gpioGetValue(RB_BTN2)==0) {
result += BTN_DOWN;
}
if (gpioGetValue(RB_BTN4)==0) {
result += BTN_ENTER;
}
if (gpioGetValue(RB_BTN0)==0) {
result += BTN_LEFT;
}
if (gpioGetValue(RB_BTN1)==0) {
result += BTN_RIGHT;
}
return result;
}