input_dump.c 701 B

1234567891011121314151617181920212223242526
  1. #include "flipper.h"
  2. #include <stdio.h>
  3. static void state_cb(const void* value, size_t size, void* ctx) {
  4. const InputState* state = value;
  5. printf("state: %02x\n", *state);
  6. }
  7. static void event_cb(const void* value, size_t size, void* ctx) {
  8. const InputEvent* event = value;
  9. printf("event: %02x %s\n", event->input, event->state ? "pressed" : "released");
  10. }
  11. void application_input_dump(void* p) {
  12. // open record
  13. FuriRecordSubscriber* state_record =
  14. furi_open("input_state", false, false, state_cb, NULL, NULL);
  15. FuriRecordSubscriber* event_record =
  16. furi_open("input_events", false, false, event_cb, NULL, NULL);
  17. for(;;) {
  18. delay(100);
  19. }
  20. }