Input events from drivers to the listeners that consume them.
More...
|
| enum | pbl_input_type : uint8_t { PBL_INPUT_EV_KEY
, PBL_INPUT_EV_ABS
, PBL_INPUT_EV_GES
} |
| | Event type. More...
|
| |
| enum | : uint16_t {
PBL_INPUT_KEY_UP = 103
, PBL_INPUT_KEY_DOWN = 108
, PBL_INPUT_KEY_BACK = 158
, PBL_INPUT_BTN_TOUCH = 330
,
PBL_INPUT_KEY_SELECT = 353
} |
| | PBL_INPUT_EV_KEY codes, with the Linux input event code values. More...
|
| |
| enum | : uint16_t { PBL_INPUT_ABS_X = 0
, PBL_INPUT_ABS_Y = 1
} |
| | PBL_INPUT_EV_ABS codes, with the Linux input event code values. More...
|
| |
| enum | : uint16_t { PBL_INPUT_GES_TAP
, PBL_INPUT_GES_DOUBLE_TAP
, PBL_INPUT_GES_PALM
} |
| | PBL_INPUT_EV_GES codes, located at the report's PBL_INPUT_ABS_X and Y. More...
|
| |
Input events from drivers to the listeners that consume them.
Drivers report events with pbl_input_report() and know nothing about who consumes them. Listeners are defined with PBL_INPUT_CALLBACK_DEFINE() next to the code they drive, collected at link time, and called synchronously in the context of the report, which is an ISR for buttons. Listeners must therefore not block, and must check pbl_in_isr() before using APIs that are not ISR-safe.
A report is a group of events closed by one with sync set, such as a touch sample:
static void prv_input_cb(
const struct pbl_input_event *evt,
void *user_data) {
...
}
}
◆ pbl_input_event
| Data Fields |
|
uint16_t |
code |
Code, depending on type. |
|
bool |
sync |
Last event of a report. |
|
enum pbl_input_type |
type |
Type. |
|
int32_t |
value |
Value, depending on type. |
◆ PBL_INPUT_CALLBACK_DEFINE
| #define PBL_INPUT_CALLBACK_DEFINE |
( |
|
_callback, |
|
|
|
_user_data |
|
) |
| |
Value:
#define PBL_ITERABLE_SECTION(type, tag, key)
Add the object to an iterable section, a table gathered at link time from any file.
Definition section.h:124
Define a listener of every input event.
- Parameters
-
| _callback | Function called for every event. |
| _user_data | Data passed to _callback. |
◆ anonymous enum
| anonymous enum : uint16_t |
PBL_INPUT_EV_KEY codes, with the Linux input event code values.
| Enumerator |
|---|
| PBL_INPUT_KEY_UP | |
| PBL_INPUT_KEY_DOWN | |
| PBL_INPUT_KEY_BACK | |
| PBL_INPUT_BTN_TOUCH | Touch contact.
|
| PBL_INPUT_KEY_SELECT | |
◆ anonymous enum
| anonymous enum : uint16_t |
PBL_INPUT_EV_ABS codes, with the Linux input event code values.
| Enumerator |
|---|
| PBL_INPUT_ABS_X | |
| PBL_INPUT_ABS_Y | |
◆ anonymous enum
| anonymous enum : uint16_t |
◆ pbl_input_type
Event type.
| Enumerator |
|---|
| PBL_INPUT_EV_KEY | Key or button, value 1 when pressed and 0 when released.
|
| PBL_INPUT_EV_ABS | Absolute axis, value in its own units (pixels for touch).
|
| PBL_INPUT_EV_GES | Gesture recognized by the device, value unused.
|
◆ pbl_input_report()
| void pbl_input_report |
( |
enum pbl_input_type |
type, |
|
|
uint16_t |
code, |
|
|
int32_t |
value, |
|
|
bool |
sync |
|
) |
| |
◆ pbl_input_report_abs()
| static void pbl_input_report_abs |
( |
uint16_t |
code, |
|
|
int32_t |
value, |
|
|
bool |
sync |
|
) |
| |
|
inlinestatic |
◆ pbl_input_report_ges()
| static void pbl_input_report_ges |
( |
uint16_t |
code, |
|
|
bool |
sync |
|
) |
| |
|
inlinestatic |
◆ pbl_input_report_key()
| static void pbl_input_report_key |
( |
uint16_t |
code, |
|
|
bool |
pressed, |
|
|
bool |
sync |
|
) |
| |
|
inlinestatic |