|
|
|
@@ -1,7 +1,6 @@
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "command.h "
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "input.h"
|
|
|
|
#include "input.h"
|
|
|
|
|
|
|
|
|
|
|
|
@@ -11,19 +10,21 @@ int printButton(const char* string) {
|
|
|
|
return printf(string);
|
|
|
|
return printf(string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this should live in the app logic
|
|
|
|
void commandWrapper(void* args, void* ret) {
|
|
|
|
void commandWrapper(void* args, void* ret) {
|
|
|
|
// we cast ret to a int and then place the return val in to it
|
|
|
|
// we cast ret to a int and then place the return val in to it
|
|
|
|
*(int*)(ret) = printButton(*(const char**)(args));
|
|
|
|
*(int*)(ret) = printButton(*(const char**)(args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this should be in your input driver, so in here you may have a task
|
|
|
|
|
|
|
|
// that is getting these inputs and adding them to a queue
|
|
|
|
static Inputs_e current_input = BUTTON_DOWN;
|
|
|
|
static Inputs_e current_input = BUTTON_DOWN;
|
|
|
|
Inputs_e getinput() {
|
|
|
|
Inputs_e getinput() {
|
|
|
|
return current_input;
|
|
|
|
return current_input;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this is the only part i dont like
|
|
|
|
|
|
|
|
const char* button_up_cmd_args = "up button pressed\n";
|
|
|
|
const char* button_up_cmd_args = "up button pressed\n";
|
|
|
|
int button_up_cmd_return_val = 0; // dont leave thing uninstalised
|
|
|
|
int button_up_cmd_return_val = 0; // dont leave thing uninstalised
|
|
|
|
|
|
|
|
|
|
|
|
@@ -36,6 +37,7 @@ int button_right_cmd_return_val = 0; // dont leave thing uninstalised
|
|
|
|
const char* button_down_cmd_args = "down button pressed\n";
|
|
|
|
const char* button_down_cmd_args = "down button pressed\n";
|
|
|
|
int button_down_cmd_return_val = 0; // dont leave thing uninstalised
|
|
|
|
int button_down_cmd_return_val = 0; // dont leave thing uninstalised
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this should be implemented with your app logic
|
|
|
|
static Input_t input_device = (Input_t){
|
|
|
|
static Input_t input_device = (Input_t){
|
|
|
|
.button_up_cmd = (Command_t){
|
|
|
|
.button_up_cmd = (Command_t){
|
|
|
|
.args = (void*)(&button_up_cmd_args),
|
|
|
|
.args = (void*)(&button_up_cmd_args),
|
|
|
|
|