input.h 1.1 KB

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