input.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * @file input.h
  3. * Input: main API
  4. */
  5. #pragma once
  6. #include <furi_hal_resources.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #define RECORD_INPUT_EVENTS "input_events"
  11. /** Input Types
  12. * Some of them are physical events and some logical
  13. */
  14. typedef enum {
  15. InputTypePress, /**< Press event, emitted after debounce */
  16. InputTypeRelease, /**< Release event, emitted after debounce */
  17. InputTypeShort, /**< Short event, emitted after InputTypeRelease done withing INPUT_LONG_PRESS interval */
  18. InputTypeLong, /**< Long event, emmited after INPUT_LONG_PRESS interval, asynchronouse to InputTypeRelease */
  19. InputTypeRepeat, /**< Repeat event, emmited with INPUT_REPEATE_PRESS period after InputTypeLong event */
  20. } InputType;
  21. /** Input Event, dispatches with FuriPubSub */
  22. typedef struct {
  23. uint32_t sequence;
  24. InputKey key;
  25. InputType type;
  26. } InputEvent;
  27. /** Get human readable input key name
  28. * @param key - InputKey
  29. * @return string
  30. */
  31. const char* input_get_key_name(InputKey key);
  32. /** Get human readable input type name
  33. * @param type - InputType
  34. * @return string
  35. */
  36. const char* input_get_type_name(InputType type);
  37. #ifdef __cplusplus
  38. }
  39. #endif