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_BACK
, PBL_INPUT_KEY_UP
, PBL_INPUT_KEY_SELECT
, PBL_INPUT_KEY_DOWN
,
PBL_INPUT_BTN_TOUCH
} |
| | PBL_INPUT_EV_KEY codes. More...
|
| |
| enum | : uint16_t { PBL_INPUT_ABS_X
, PBL_INPUT_ABS_Y
} |
| | PBL_INPUT_EV_ABS codes. 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_USED
Keep the symbol even if it appears unreferenced.
Definition compiler.h:95
#define PBL_ALIGNED(bytes)
Align the symbol or type.
Definition compiler.h:92
#define PBL_SECTION(name)
Place the symbol in a linker section.
Definition compiler.h:134
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.
| Enumerator |
|---|
| PBL_INPUT_KEY_BACK | |
| PBL_INPUT_KEY_UP | |
| PBL_INPUT_KEY_SELECT | |
| PBL_INPUT_KEY_DOWN | |
| PBL_INPUT_BTN_TOUCH | Touch contact.
|
◆ anonymous enum
| anonymous enum : uint16_t |
◆ 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 |