input.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. InputTypeMAX, /**< Special value for exceptional */
  21. } InputType;
  22. /** Input Event, dispatches with FuriPubSub */
  23. typedef struct {
  24. uint32_t sequence;
  25. InputKey key;
  26. InputType type;
  27. } InputEvent;
  28. /** Get human readable input key name
  29. * @param key - InputKey
  30. * @return string
  31. */
  32. const char* input_get_key_name(InputKey key);
  33. /** Get human readable input type name
  34. * @param type - InputType
  35. * @return string
  36. */
  37. const char* input_get_type_name(InputType type);
  38. #ifdef __cplusplus
  39. }
  40. #endif