|
PebbleOS v4.47.0-512-g5285d4236
|
Vibration motor class. More...
Modules | |
| AW86225 | |
| Awinic AW86225 Vibration motor driver. | |
| AW8623X | |
| Awinic AW8623X Vibration motor driver, driving an LRA in continuous mode. | |
| DRV2604 | |
| TI DRV2604 Vibration motor driver, driving an LRA in real-time playback mode. | |
| Simulator | |
| Simulated vibration motor, reporting its strength to an observer. | |
Data Structures | |
| struct | pbl_vibe_ops |
| Vibration motor driver operations, called with the device lock held. More... | |
| struct | pbl_vibe_state |
| Vibration motor runtime state. More... | |
| struct | pbl_vibe |
| Vibration motor. More... | |
Macros | |
| #define | VIBE_STRENGTH_MAX 100 |
| Full power. | |
| #define | VIBE_STRENGTH_MIN -100 |
| Full reverse, for drivers that can brake. | |
| #define | VIBE_STRENGTH_OFF 0 |
| Stopped. | |
| #define | PBL_VIBE_CALIBRATION_NONE 0xFFU |
| Calibration value of a driver that keeps nothing to persist. | |
| #define | PBL_VIBE_STATE_DEFINE(sym) |
| Define the class state of a vibration motor. | |
| #define | PBL_VIBE_INIT(sym, _name, _parent, _ops, _braking_strength) |
| Initialize a struct pbl_vibe. | |
Functions | |
| int | pbl_vibe_start (const struct pbl_vibe *vibe, int8_t strength) |
| Drive the motor, starting it if stopped. | |
| int | pbl_vibe_stop (const struct pbl_vibe *vibe) |
| Stop the motor. | |
| int8_t | pbl_vibe_get_braking_strength (const struct pbl_vibe *vibe) |
| Get the strength that brakes the motor to a stop. | |
| int | pbl_vibe_calibrate (const struct pbl_vibe *vibe, uint8_t *cali) |
| Calibrate the motor driver. | |
| int | pbl_vibe_set_calibration (const struct pbl_vibe *vibe, uint8_t cali) |
| Apply a calibration value returned by pbl_vibe_calibrate(). | |
Variables | |
| const struct pbl_vibe *const | VIBE |
| The board's vibration motor. | |
Vibration motor class.
A vibration motor is a struct pbl_vibe device. Every call into the driver runs with the device lock held, a recursive mutex.
| struct pbl_vibe_state |
Vibration motor runtime state.
| Data Fields | ||
|---|---|---|
| struct pbl_mutex | lock | Device lock. |
| struct pbl_vibe |
Vibration motor.
| Data Fields | ||
|---|---|---|
| int8_t | braking_strength | Strength that brakes the motor, VIBE_STRENGTH_OFF if the driver cannot brake. |
| struct pbl_device | dev | Device. |
| const struct pbl_vibe_ops * | ops | Driver operations. |
| struct pbl_vibe_state * | state | Runtime state. |
| #define PBL_VIBE_CALIBRATION_NONE 0xFFU |
Calibration value of a driver that keeps nothing to persist.
| #define PBL_VIBE_INIT | ( | sym, | |
| _name, | |||
| _parent, | |||
| _ops, | |||
| _braking_strength | |||
| ) |
Initialize a struct pbl_vibe.
| sym | Symbol of the instance, as passed to PBL_VIBE_STATE_DEFINE(). |
| _name | Device name. |
| _parent | Parent device. |
| _ops | Driver operations. |
| _braking_strength | Strength that brakes the motor, or VIBE_STRENGTH_OFF. |
| #define PBL_VIBE_STATE_DEFINE | ( | sym | ) |
Define the class state of a vibration motor.
| sym | Symbol of the instance. |
| #define VIBE_STRENGTH_MAX 100 |
Full power.
| #define VIBE_STRENGTH_MIN -100 |
Full reverse, for drivers that can brake.
| #define VIBE_STRENGTH_OFF 0 |
Stopped.
| int pbl_vibe_calibrate | ( | const struct pbl_vibe * | vibe, |
| uint8_t * | cali | ||
| ) |
Calibrate the motor driver.
| vibe | Vibration motor. | |
| [out] | cali | Value to persist and later pass to pbl_vibe_set_calibration(), or PBL_VIBE_CALIBRATION_NONE. |
| int8_t pbl_vibe_get_braking_strength | ( | const struct pbl_vibe * | vibe | ) |
Get the strength that brakes the motor to a stop.
| vibe | Vibration motor. |
| int pbl_vibe_set_calibration | ( | const struct pbl_vibe * | vibe, |
| uint8_t | cali | ||
| ) |
Apply a calibration value returned by pbl_vibe_calibrate().
| vibe | Vibration motor. |
| cali | Calibration value. |
| int pbl_vibe_start | ( | const struct pbl_vibe * | vibe, |
| int8_t | strength | ||
| ) |
Drive the motor, starting it if stopped.
Drivers without reverse drive use the absolute value of strength.
| vibe | Vibration motor. |
| strength | Strength from VIBE_STRENGTH_MIN to VIBE_STRENGTH_MAX. |
| int pbl_vibe_stop | ( | const struct pbl_vibe * | vibe | ) |
Stop the motor.
| vibe | Vibration motor. |
|
extern |
The board's vibration motor.