PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
vibe.h File Reference
#include <stdint.h>
#include <pbl/device.h>
#include <pbl/kernel/mutex.h>

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.