PebbleOS v4.48.0-75-g7416f78a1
Loading...
Searching...
No Matches

Awinic AW86225 Vibration motor driver. More...

Data Structures

struct  pbl_vibe_aw86225_state
 AW86225 driver state, owned by the driver. More...
 
struct  pbl_vibe_aw86225
 AW86225 haptic driver. More...
 

Macros

#define PBL_VIBE_AW86225_DEFINE(sym, _bus, _addr, _reset, _f0_hz, _f0_tolerance_hz, _rated_uv, _gain_percent, _supply)
 Define an AW86225.
 

Detailed Description

Awinic AW86225 Vibration motor driver.

Plays a sine cycle at the LRA's resonant frequency from the chip's RAM in an infinite loop, with the gain compensated for the supply voltage.


Data Structure Documentation

◆ pbl_vibe_aw86225_state

struct pbl_vibe_aw86225_state

AW86225 driver state, owned by the driver.

Data Fields
bool playing Playback running.
uint8_t strength Drive strength, 0 to VIBE_STRENGTH_MAX.
uint8_t trim_lra Resonant frequency trim.
bool trim_valid trim_lra holds a calibration.
uint16_t vbat_mv Supply voltage measured before the last playback, in mV, or 0 if not measured.

◆ pbl_vibe_aw86225

struct pbl_vibe_aw86225

AW86225 haptic driver.

Data Fields
uint16_t f0_hz Nominal resonant frequency of the LRA, in Hz.
uint16_t f0_tolerance_hz Accepted deviation of the measured resonant frequency, in Hz.
uint8_t gain_percent Measured output as a percentage of the nominal model of the chip.
struct pbl_i2c_dev i2c I2C device.
uint16_t rated_mv Rated drive voltage of the LRA, in mV RMS.
struct pbl_gpio reset Reset line, active while the chip is held in reset.
struct pbl_vibe_aw86225_state * state Driver state.
const struct pbl_regulator * supply Supply, or NULL.
struct pbl_vibe vibe Vibration motor, child of the I2C bus.

Macro Definition Documentation

◆ PBL_VIBE_AW86225_DEFINE

#define PBL_VIBE_AW86225_DEFINE (   sym,
  _bus,
  _addr,
  _reset,
  _f0_hz,
  _f0_tolerance_hz,
  _rated_uv,
  _gain_percent,
  _supply 
)
Value:
static_assert((_gain_percent) >= 50 && (_gain_percent) <= 100, "output gain of 50 to 100%"); \
static_assert( \
(_rated_uv) / 1000U * 1414U / 1000U <= PBL_VIBE_AW86225_FULL_SCALE_MV(_gain_percent), \
"rated voltage exceeds the full-scale output"); \
PBL_VIBE_STATE_DEFINE(sym); \
static struct pbl_vibe_aw86225_state sym##_aw86225_state = {.strength = VIBE_STRENGTH_MAX}; \
PBL_DEVICE_INSTANCE(sym, struct pbl_vibe_aw86225, struct pbl_vibe, vibe) { \
.vibe = PBL_VIBE_INIT(sym, "aw86225", &(_bus)->dev, &pbl_vibe_aw86225_ops, VIBE_STRENGTH_OFF), \
.state = &sym##_aw86225_state, .i2c = PBL_I2C_DEV(_bus, _addr), .reset = _reset, \
.f0_hz = (_f0_hz), .f0_tolerance_hz = (_f0_tolerance_hz), .rated_mv = (_rated_uv) / 1000U, \
.gain_percent = (_gain_percent), .supply = (_supply), \
}
#define PBL_I2C_DEV(_bus, _addr)
Initializer for a struct pbl_i2c_dev.
Definition i2c.h:159
uint8_t strength
Drive strength, 0 to VIBE_STRENGTH_MAX.
Definition aw86225.h:27
AW86225 haptic driver.
Definition aw86225.h:39
AW86225 driver state, owned by the driver.
Definition aw86225.h:25
Vibration motor.
Definition driver.h:44
#define PBL_VIBE_INIT(sym, _name, _parent, _ops, _braking_strength)
Initialize a struct pbl_vibe.
Definition driver.h:78
#define VIBE_STRENGTH_MAX
Full power.
Definition vibe.h:27
#define VIBE_STRENGTH_OFF
Stopped.
Definition vibe.h:31

Define an AW86225.

Parameters
symSymbol of the motor driver.
_busI2C bus.
_addr7-bit I2C address.
_resetReset line, from PBL_GPIO().
_f0_hzNominal resonant frequency of the LRA, in Hz.
_f0_tolerance_hzAccepted deviation of the measured resonant frequency, in Hz.
_rated_uvRated drive voltage of the LRA, in uV RMS.
_gain_percentMeasured output as a percentage of the nominal model of the chip, 50 to 100; 100 applies no correction.
_supplySupply, or NULL.