PebbleOS
Loading...
Searching...
No Matches
Macros | Functions
Vibration motor

Vibration motor driver interface. 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.
 

Functions

void vibe_init (void)
 Initialize the vibration motor driver.
 
void vibe_ctl (bool on)
 Start or stop the motor at the strength set with vibe_set_strength().
 
void vibe_force_off (void)
 Stop the motor immediately.
 
void vibe_set_strength (int8_t strength)
 Set the drive strength.
 
int8_t vibe_get_braking_strength (void)
 Get the strength to use to brake the motor to a stop.
 
status_t vibe_calibrate (void)
 Calibrate the motor driver.
 
uint8_t vibe_get_calibration (void)
 Get the calibration computed by the last successful vibe_calibrate().
 
void vibe_apply_calibration (uint8_t cali)
 Apply a calibration value previously returned by vibe_get_calibration().
 

Detailed Description

Vibration motor driver interface.

vibe_ctl(true);
// ...
vibe_ctl(false);
#define VIBE_STRENGTH_MAX
Full power.
Definition vibe.h:26
void vibe_ctl(bool on)
Start or stop the motor at the strength set with vibe_set_strength().
void vibe_set_strength(int8_t strength)
Set the drive strength.

Macro Definition Documentation

◆ VIBE_STRENGTH_MAX

#define VIBE_STRENGTH_MAX   100

Full power.

◆ VIBE_STRENGTH_MIN

#define VIBE_STRENGTH_MIN   -100

Full reverse, for drivers that can brake.

◆ VIBE_STRENGTH_OFF

#define VIBE_STRENGTH_OFF   0

Stopped.

Function Documentation

◆ vibe_apply_calibration()

void vibe_apply_calibration ( uint8_t  cali)

Apply a calibration value previously returned by vibe_get_calibration().

Parameters
caliCalibration value.

◆ vibe_calibrate()

status_t vibe_calibrate ( void  )

Calibrate the motor driver.

If the driver has non-volatile memory, a successful calibration is stored there.

Return values
S_SUCCESSCalibration succeeded.
Returns
Otherwise an error code.

◆ vibe_ctl()

void vibe_ctl ( bool  on)

Start or stop the motor at the strength set with vibe_set_strength().

Parameters
ontrue to start.

◆ vibe_force_off()

void vibe_force_off ( void  )

Stop the motor immediately.

◆ vibe_get_braking_strength()

int8_t vibe_get_braking_strength ( void  )

Get the strength to use to brake the motor to a stop.

Returns
Braking strength, VIBE_STRENGTH_OFF if the driver does not brake this way.

◆ vibe_get_calibration()

uint8_t vibe_get_calibration ( void  )

Get the calibration computed by the last successful vibe_calibrate().

Returns
Driver-specific calibration value, to persist to non-volatile storage.

◆ vibe_init()

void vibe_init ( void  )

Initialize the vibration motor driver.

◆ vibe_set_strength()

void vibe_set_strength ( int8_t  strength)

Set the drive strength.

Drivers without reverse drive use the absolute value.

Parameters
strengthStrength from VIBE_STRENGTH_MIN to VIBE_STRENGTH_MAX.