8c36d65e63
* Add input driver and definitions for target_f2 * Add input_dump example * Invert charge input * Fix back and left button configuration * remove input debug * input testing case * move header * lint code Co-authored-by: aanper <mail@s3f.ru>
30 lines
798 B
C
30 lines
798 B
C
#include "flipper.h"
|
|
#include <stdio.h>
|
|
|
|
static void state_cb(const void* value, size_t size, void* ctx) {
|
|
const InputState* state = value;
|
|
|
|
printf("state: %02x\n", *state);
|
|
}
|
|
|
|
static void event_cb(const void* value, size_t size, void* ctx) {
|
|
const InputEvent* event = value;
|
|
|
|
printf("event: %02x %s\n", event->input, event->state ? "pressed" : "released");
|
|
}
|
|
|
|
void application_input_dump(void* p) {
|
|
// TODO try open record and retry on timeout (needs FURI behaviour change)
|
|
delay(1000);
|
|
|
|
// open record
|
|
FuriRecordSubscriber* state_record =
|
|
furi_open("input_state", false, false, state_cb, NULL, NULL);
|
|
FuriRecordSubscriber* event_record =
|
|
furi_open("input_events", false, false, event_cb, NULL, NULL);
|
|
|
|
for(;;) {
|
|
delay(100);
|
|
}
|
|
}
|