Input: refactoring, platform agnostic key configuration.
Update input usage across project. Minor queue usage fixes and tick timings. (#330)
This commit is contained in:
@@ -4,27 +4,17 @@
|
||||
|
||||
typedef union {
|
||||
unsigned int packed;
|
||||
InputState state;
|
||||
InputType state;
|
||||
} InputDump;
|
||||
|
||||
static void state_cb(const void* value, void* ctx) {
|
||||
InputDump dump = {.packed = 0};
|
||||
dump.state = *(InputState*)value;
|
||||
|
||||
printf("state: %02x\r\n", dump.packed);
|
||||
}
|
||||
|
||||
static void event_cb(const void* value, void* ctx) {
|
||||
const InputEvent* event = value;
|
||||
|
||||
printf("event: %02x %s\r\n", event->input, event->state ? "pressed" : "released");
|
||||
printf("event: %02x %s\r\n", event->key, event->type ? "pressed" : "released");
|
||||
}
|
||||
|
||||
void application_input_dump(void* p) {
|
||||
// open record
|
||||
ValueManager* state_record = furi_record_open("input_state");
|
||||
subscribe_pubsub(&state_record->pubsub, state_cb, NULL);
|
||||
|
||||
PubSub* event_record = furi_record_open("input_events");
|
||||
subscribe_pubsub(event_record, event_cb, NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user