Interface for touchscreen drivers.
More...
Interface for touchscreen drivers.
A driver embeds a struct pbl_touch in its instance, sets it up with PBL_TOUCH_STATE_DEFINE() and PBL_TOUCH_INIT(), implements the struct pbl_touch_ops the class calls, and reports with pbl_touch_report() and pbl_touch_report_gesture().
◆ pbl_touch_state
Touchscreen runtime state.
◆ pbl_touch
◆ PBL_TOUCH_INIT
| #define PBL_TOUCH_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_ops, |
|
|
|
... |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_touch_state, \
.props = {__VA_ARGS__}, \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
Initialize a struct pbl_touch.
- Parameters
-
◆ PBL_TOUCH_STATE_DEFINE
| #define PBL_TOUCH_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
struct pbl_mutex lock
Device lock.
Definition driver.h:40
Touchscreen runtime state.
Definition driver.h:38
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50
Define the class state of a touchscreen.
- Parameters
-
| sym | Symbol of the instance. |
◆ pbl_touch_lock()
| void pbl_touch_lock |
( |
const struct pbl_touch * |
touch | ) |
|
Take the device lock.
Drivers take it around the hardware access of their interrupt bottom half.
- Parameters
-
◆ pbl_touch_report()
| void pbl_touch_report |
( |
const struct pbl_touch * |
touch, |
|
|
bool |
down, |
|
|
uint16_t |
x, |
|
|
uint16_t |
y |
|
) |
| |
Report a sample.
Called by the driver from thread context without the device lock held.
- Parameters
-
| touch | Touchscreen. |
| down | Whether there is a touch contact. |
| x | X coordinate reported by the controller. |
| y | Y coordinate reported by the controller. |
◆ pbl_touch_report_gesture()
| void pbl_touch_report_gesture |
( |
const struct pbl_touch * |
touch, |
|
|
uint16_t |
code, |
|
|
uint16_t |
x, |
|
|
uint16_t |
y |
|
) |
| |
Report a gesture recognized by the controller.
Called by the driver from thread context without the device lock held.
- Parameters
-
| touch | Touchscreen. |
| code | PBL_INPUT_EV_GES code. |
| x | X coordinate reported by the controller. |
| y | Y coordinate reported by the controller. |
◆ pbl_touch_unlock()
| void pbl_touch_unlock |
( |
const struct pbl_touch * |
touch | ) |
|
Release the device lock.
- Parameters
-