input.h 1.0 KB

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