Interface for vibration motor drivers.
More...
Interface for vibration motor drivers.
A driver embeds a struct pbl_vibe in its instance, sets it up with PBL_VIBE_STATE_DEFINE() and PBL_VIBE_INIT(), and implements the struct pbl_vibe_ops the class calls.
◆ pbl_vibe_state
Vibration motor runtime state.
| Data Fields |
|
struct pbl_mutex |
lock |
Device lock. |
◆ pbl_vibe
◆ PBL_VIBE_INIT
| #define PBL_VIBE_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_ops, |
|
|
|
_braking_strength |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_vibe_state, \
.braking_strength = (_braking_strength), \
}
#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_vibe.
- Parameters
-
◆ PBL_VIBE_STATE_DEFINE
| #define PBL_VIBE_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
Vibration motor 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 vibration motor.
- Parameters
-
| sym | Symbol of the instance. |