2020-10-26 09:26:15 +00:00
|
|
|
#include "flipper_v2.h"
|
2020-10-02 06:44:05 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2020-10-26 09:26:15 +00:00
|
|
|
static void state_cb(const void* value, void* ctx) {
|
2020-10-02 06:44:05 +00:00
|
|
|
const InputState* state = value;
|
|
|
|
|
|
|
|
printf("state: %02x\n", *state);
|
|
|
|
}
|
|
|
|
|
2020-10-26 09:26:15 +00:00
|
|
|
static void event_cb(const void* value, void* ctx) {
|
2020-10-02 06:44:05 +00:00
|
|
|
const InputEvent* event = value;
|
|
|
|
|
|
|
|
printf("event: %02x %s\n", event->input, event->state ? "pressed" : "released");
|
|
|
|
}
|
|
|
|
|
|
|
|
void application_input_dump(void* p) {
|
|
|
|
// open record
|
2020-10-26 09:26:15 +00:00
|
|
|
ValueManager* state_record = furi_open("input_state");
|
|
|
|
assert(state_record != NULL);
|
|
|
|
subscribe_pubsub(&state_record->pubsub, state_cb, NULL);
|
|
|
|
|
|
|
|
PubSub* event_record = furi_open("input_events");
|
|
|
|
assert(event_record != NULL);
|
|
|
|
subscribe_pubsub(event_record, event_cb, NULL);
|
2020-10-02 06:44:05 +00:00
|
|
|
|
|
|
|
for(;;) {
|
|
|
|
delay(100);
|
|
|
|
}
|
|
|
|
}
|