PebbleOS
Loading...
Searching...
No Matches

Awinic AW86225 Vibration motor driver. More...

Data Structures

struct  pbl_aw86225_state
 AW86225 driver state, owned by the driver. More...
 
struct  pbl_aw86225
 AW86225 haptic driver. More...
 

Macros

#define PBL_AW86225_DEFINE(sym, _bus, _addr, _reset)
 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. The LRA is described by the CONFIG_VIBE_AW86225_* options.

PBL_AW86225_DEFINE(s_aw86225, &s_i2c.bus, 0x58, PBL_GPIO(SF32LB_GPIO1, 1, PBL_GPIO_ACTIVE_LOW));
const struct pbl_vibe *const VIBE = &s_aw86225.vibe;
#define SF32LB_GPIO1
Port GPIO1 (PA).
Definition sf32lb.h:46
#define PBL_GPIO_ACTIVE_LOW
The pin is active when low.
Definition gpio.h:50
#define PBL_GPIO(_port, _pin, _flags)
Initializer for a struct pbl_gpio.
Definition gpio.h:148
#define PBL_AW86225_DEFINE(sym, _bus, _addr, _reset)
Define an AW86225.
Definition aw86225.h:68
Vibration motor.
Definition vibe.h:60
const struct pbl_vibe *const VIBE
The board's vibration motor.

Data Structure Documentation

◆ pbl_aw86225_state

struct pbl_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_aw86225

struct pbl_aw86225

AW86225 haptic driver.

Data Fields
struct pbl_i2c_dev i2c I2C device.
struct pbl_gpio reset Reset line, active while the chip is held in reset.
struct pbl_aw86225_state * state Driver state.
struct pbl_vibe vibe Vibration motor, child of the I2C bus.

Macro Definition Documentation

◆ PBL_AW86225_DEFINE

#define PBL_AW86225_DEFINE (   sym,
  _bus,
  _addr,
  _reset 
)
Value:
static struct pbl_aw86225_state sym##_aw86225_state = {.strength = VIBE_STRENGTH_MAX}; \
const struct pbl_aw86225 sym = { \
.vibe = PBL_VIBE_INIT(sym, "aw86225", &(_bus)->dev, &pbl_aw86225_ops, VIBE_STRENGTH_OFF), \
.state = &sym##_aw86225_state, \
.i2c = PBL_I2C_DEV(_bus, _addr), \
.reset = _reset, \
}; \
PBL_DEVICE_REGISTER(sym, &sym.vibe.dev)
#define PBL_I2C_DEV(_bus, _addr)
Initializer for a struct pbl_i2c_dev.
Definition i2c.h:135
struct pbl_vibe vibe
Vibration motor, child of the I2C bus.
Definition aw86225.h:47
uint8_t strength
Drive strength, 0 to VIBE_STRENGTH_MAX.
Definition aw86225.h:33
AW86225 haptic driver.
Definition aw86225.h:45
AW86225 driver state, owned by the driver.
Definition aw86225.h:31
struct pbl_vibe_state * state
Runtime state.
Definition vibe.h:66
struct pbl_device dev
Device.
Definition vibe.h:62
#define VIBE_STRENGTH_MAX
Full power.
Definition vibe.h:28
#define PBL_VIBE_INIT(sym, _name, _parent, _ops, _braking_strength)
Initialize a struct pbl_vibe.
Definition vibe.h:97
#define VIBE_STRENGTH_OFF
Stopped.
Definition vibe.h:32
#define PBL_VIBE_STATE_DEFINE(sym)
Define the class state of a vibration motor.
Definition vibe.h:84

Define an AW86225.

Parameters
symSymbol of the instance; the motor is sym.vibe.
_busI2C bus.
_addr7-bit I2C address.
_resetReset line (struct pbl_gpio).