31#include "../SensorBuildOpt.h"
32#if !SENSORLIB_EXCLUDE_HAPTIC_DRV2605
40static constexpr uint8_t DRV2605_SLAVE_ADDRESS = 0x5A;
159 bool stop()
override;
191 bool setGain(uint8_t gain)
override;
200 uint8_t
getGain()
const override;
365 uint32_t
getF0()
const override;
512 bool initImpl(uint8_t param)
override;
514 void afterInitSuccess(uint8_t param)
override
518 uint8_t _currentLibrary;
519 uint8_t _waveformSeq[8];
520 uint8_t _waveformCount;
HapticStatus
Vibration playback status.
HapticActuatorType
Actuator type.
HapticMode
Generic haptic operating mode.
uint16_t HapticEffectId
Haptic effect ID type.
Abstract base class for haptic drivers.
void setReady(bool ready)
Set ready state.
Driver for the TI DRV2605/DRV2604 haptic motor controller.
bool isDone() const
Check if playback is done.
uint32_t getVbat() override
Get the battery voltage.
void setAutoBrake(bool enable)
Enable/disable automatic braking.
void setRtpOverdrive(bool enable)
Enable/disable RTP overdrive.
bool setActuatorType(HapticActuatorType type) override
Set the actuator type.
HapticActuatorType getActuatorType() const override
Get the actuator type.
bool calibrate() override
Perform auto-calibration.
uint32_t getF0() const override
Get the measured resonant frequency (F0).
void setCtrl4(uint8_t value)
Set the control4 register value.
bool run() override
Start haptic playback.
~HapticDriver_DRV2605() override
Destructor.
void setRatedVoltage(uint8_t value)
Set the rated voltage for auto-calibration.
bool isReady() const override
Check if the driver is initialized and ready.
bool playEffectAsync(HapticEffectId effect) override
Play a haptic effect (non-blocking).
void selectLibrary(uint8_t lib)
Select the ROM waveform library.
void setBrakeTime(uint8_t time)
Set the brake time offset.
bool isPlaying() const override
Check if haptic is currently playing.
void end() override
Deinitialize the driver and release resources.
void continuousVibration(uint32_t duration_ms, bool blocking=true) override
Play a continuous vibration for specified duration.
void emergencyStop() override
Emergency stop - stops all vibration immediately.
int autoCal()
Perform auto-calibration and return compensation result.
void setOverdriveClamp(uint8_t value)
Set the overdrive clamp voltage for auto-calibration.
void setOverdriveTime(uint8_t cycles)
Set the number of overdrive cycles.
uint8_t getRealtimeValue() const
Get the current RTP value.
bool setMode(HapticMode mode) override
Set the operating mode.
void vibrationUpdate() override
Update vibration state (for non-blocking mode).
bool setSequence(uint8_t slot, HapticEffectId effect) override
Set a waveform in the sequence.
HapticStatus getStatus() const override
Get current playback status.
uint8_t getChipID() const override
Get the chip ID.
bool setGain(uint8_t gain) override
Set the gain/amplitude.
bool playSequence() override
Play the waveform sequence.
uint8_t getGain() const override
Get the current gain value.
void setERMLRA(bool erm)
Enable/disable ERM/LRA mode.
bool playEffect(HapticEffectId effect) override
Play a haptic effect.
const char * getChipName() const override
Get the chip name.
HapticMode getMode() const override
Get the current operating mode.
bool stop() override
Stop haptic playback immediately.
bool clearSequence() override
Clear the waveform sequence.
HapticDriver_DRV2605()
Construct an uninitialized driver instance.
void trigger()
Trigger a single playback cycle.
HapticCapabilities getCapabilities() const override
Get device capabilities.
bool setRealtimeValue(uint8_t value) override
Set RTP (real-time playback) value.
uint8_t getLRAFrequency() const
Read the LRA resonance period (for LRA calibration).
bool needsCalibration() const override
Check if calibration is needed.
void setWaveform(uint8_t slot, uint8_t w)
Set a waveform entry in the playback sequence table.