2021-10-03 10:36:05 +00:00
|
|
|
/**
|
|
|
|
* @file input.h
|
|
|
|
* Input: main API
|
|
|
|
*/
|
|
|
|
|
2021-02-10 08:56:05 +00:00
|
|
|
#pragma once
|
2020-10-02 06:44:05 +00:00
|
|
|
|
2021-08-08 18:03:25 +00:00
|
|
|
#include <furi-hal-resources.h>
|
2020-10-02 06:44:05 +00:00
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Input Types
|
2021-02-10 08:56:05 +00:00
|
|
|
* Some of them are physical events and some logical
|
|
|
|
*/
|
2020-10-02 06:44:05 +00:00
|
|
|
typedef enum {
|
2021-10-03 10:36:05 +00:00
|
|
|
InputTypePress, /**< Press event, emitted after debounce */
|
|
|
|
InputTypeRelease, /**< Release event, emitted after debounce */
|
|
|
|
InputTypeShort, /**< Short event, emitted after InputTypeRelease done withing INPUT_LONG_PRESS interval */
|
|
|
|
InputTypeLong, /**< Long event, emmited after INPUT_LONG_PRESS interval, asynchronouse to InputTypeRelease */
|
|
|
|
InputTypeRepeat, /**< Repeat event, emmited with INPUT_REPEATE_PRESS period after InputTypeLong event */
|
2021-02-10 08:56:05 +00:00
|
|
|
} InputType;
|
2020-10-02 06:44:05 +00:00
|
|
|
|
2021-11-01 20:35:54 +00:00
|
|
|
/** Input Event, dispatches with FuriPubSub */
|
2020-10-02 06:44:05 +00:00
|
|
|
typedef struct {
|
2021-09-01 21:05:00 +00:00
|
|
|
uint32_t sequence;
|
2021-02-10 08:56:05 +00:00
|
|
|
InputKey key;
|
|
|
|
InputType type;
|
2020-10-02 06:44:05 +00:00
|
|
|
} InputEvent;
|
2021-08-31 08:22:52 +00:00
|
|
|
|
|
|
|
/** Get human readable input key name
|
|
|
|
* @param key - InputKey
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
const char* input_get_key_name(InputKey key);
|
|
|
|
|
|
|
|
/** Get human readable input type name
|
|
|
|
* @param type - InputType
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
const char* input_get_type_name(InputType type);
|