Skip to content

Commit

Permalink
fixed button input checking, you are now able to boot different payloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartie95 committed Feb 19, 2016
1 parent 28e1df9 commit a6eec05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion bootloader/source/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ u32 InputWait() {
}
u32 GetInput() {
u32 pad_state = HID_STATE;

return ~pad_state;
}
}
22 changes: 9 additions & 13 deletions bootloader/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,15 @@ int main() {
iniparse(INI_FILE, handler, &app);
debug("Checking key");

u32 key = GetInput();
switch (key) {
// using X-macros to generate each switch-case rules
// https://en.wikibooks.org/wiki/C_Programming/Preprocessor#X-Macros
#define KEY(k) \
case KEY_##k: \
app.section = "KEY_"#k; \
break;
#include "keys.def"
default:
app.section = "DEFAULT";
break;
}
u32 key = GetInput();
// using X-macros to generate each switch-case rules
// https://en.wikibooks.org/wiki/C_Programming/Preprocessor#X-Macros
#define KEY(k) \
if(key & KEY_##k) \
app.section = "KEY_"#k; \
else
#include "keys.def"
app.section = "DEFAULT";

debug("Key checked- selected section:");
debug(app.section);
Expand Down

0 comments on commit a6eec05

Please sign in to comment.