SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
HapticDriver_DRV2605 Class Reference

Driver for the TI DRV2605/DRV2604 haptic motor controller. More...

#include <HapticDriver_DRV2605.hpp>

Inheritance diagram for HapticDriver_DRV2605:
[legend]

Public Member Functions

 HapticDriver_DRV2605 ()
 Construct an uninitialized driver instance.
 
 ~HapticDriver_DRV2605 () override
 Destructor.
 
void end () override
 Deinitialize the driver and release resources.
 
bool isReady () const override
 Check if the driver is initialized and ready.
 
const char * getChipName () const override
 Get the chip name.
 
bool run () override
 Start haptic playback.
 
bool stop () override
 Stop haptic playback immediately.
 
bool isPlaying () const override
 Check if haptic is currently playing.
 
HapticStatus getStatus () const override
 Get current playback status.
 
void emergencyStop () override
 Emergency stop - stops all vibration immediately.
 
bool setGain (uint8_t gain) override
 Set the gain/amplitude.
 
uint8_t getGain () const override
 Get the current gain value.
 
bool playEffect (HapticEffectId effect) override
 Play a haptic effect.
 
bool playEffectAsync (HapticEffectId effect) override
 Play a haptic effect (non-blocking).
 
void continuousVibration (uint32_t duration_ms, bool blocking=true) override
 Play a continuous vibration for specified duration.
 
void vibrationUpdate () override
 Update vibration state (for non-blocking mode).
 
bool setSequence (uint8_t slot, HapticEffectId effect) override
 Set a waveform in the sequence.
 
bool clearSequence () override
 Clear the waveform sequence.
 
bool playSequence () override
 Play the waveform sequence.
 
HapticCapabilities getCapabilities () const override
 Get device capabilities.
 
uint8_t getChipID () const override
 Get the chip ID.
 
HapticActuatorType getActuatorType () const override
 Get the actuator type.
 
bool setActuatorType (HapticActuatorType type) override
 Set the actuator type.
 
bool setMode (HapticMode mode) override
 Set the operating mode.
 
HapticMode getMode () const override
 Get the current operating mode.
 
bool setRealtimeValue (uint8_t value) override
 Set RTP (real-time playback) value.
 
bool calibrate () override
 Perform auto-calibration.
 
bool needsCalibration () const override
 Check if calibration is needed.
 
uint32_t getF0 () const override
 Get the measured resonant frequency (F0).
 
uint32_t getVbat () override
 Get the battery voltage.
 
void setWaveform (uint8_t slot, uint8_t w)
 Set a waveform entry in the playback sequence table.
 
void selectLibrary (uint8_t lib)
 Select the ROM waveform library.
 
bool isDone () const
 Check if playback is done.
 
void trigger ()
 Trigger a single playback cycle.
 
uint8_t getRealtimeValue () const
 Get the current RTP value.
 
void setRatedVoltage (uint8_t value)
 Set the rated voltage for auto-calibration.
 
void setOverdriveClamp (uint8_t value)
 Set the overdrive clamp voltage for auto-calibration.
 
int autoCal ()
 Perform auto-calibration and return compensation result.
 
void setAutoBrake (bool enable)
 Enable/disable automatic braking.
 
void setOverdriveTime (uint8_t cycles)
 Set the number of overdrive cycles.
 
void setBrakeTime (uint8_t time)
 Set the brake time offset.
 
void setRtpOverdrive (bool enable)
 Enable/disable RTP overdrive.
 
void setERMLRA (bool erm)
 Enable/disable ERM/LRA mode.
 
void setCtrl4 (uint8_t value)
 Set the control4 register value.
 
uint8_t getLRAFrequency () const
 Read the LRA resonance period (for LRA calibration).
 
- Public Member Functions inherited from HapticBase
virtual ~HapticBase ()=default
 
- Public Member Functions inherited from I2CDeviceWithHal
bool begin (SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
 Initialize the sensor using custom callback interface.
 
- Public Member Functions inherited from DeviceBeginCommon
virtual ~DeviceBeginCommon ()
 
uint8_t getAddress () const
 
uint8_t getInterface () const
 
- Public Member Functions inherited from SensorCommWrapper
 SensorCommWrapper ()=default
 
int readReg (uint8_t reg) const
 
int readRegBuff (uint8_t reg, uint8_t *buf, size_t len) const
 
int readBuff (uint8_t *buf, size_t len) const
 
int writeReg (uint8_t reg, uint8_t val)
 
int writeRegBuff (uint8_t reg, uint8_t *buf, size_t len)
 
int writeBuff (uint8_t *buf, size_t len)
 
int writeThenRead (const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len)
 
bool setRegBit (uint8_t reg, uint8_t bit)
 
bool clrRegBit (uint8_t reg, uint8_t bit)
 
bool getRegBit (uint8_t reg, uint8_t bit)
 
int updateBits (uint8_t reg, uint8_t mask, uint8_t value_shifted)
 
void setAddress (uint8_t address)
 
void setAck (bool enable)
 
- Public Member Functions inherited from SensorCommInterface
virtual ~SensorCommInterface ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from HapticBase
 HapticBase (const char *name)
 Constructor for derived classes.
 
void setReady (bool ready)
 Set ready state.
 
- Protected Member Functions inherited from I2CDeviceWithHal
bool ensureValid () const override
 Ensure the communication interface is valid.
 
- Protected Member Functions inherited from DeviceBeginCommon
 DeviceBeginCommon ()=default
 
virtual SensorCommBasegetComm () const override
 
virtual void beforeBegin ()
 
virtual void afterCommReady ()
 
virtual void onBeginFail ()
 
bool fail ()
 
void clearCommState ()
 
template<typename CreateComm >
bool beginLifecycle (uint8_t addr, uint8_t iface, uint8_t initParam, CreateComm createComm)
 
- Protected Attributes inherited from HapticBase
const char * _chipName
 
bool _isReady
 
- Protected Attributes inherited from DeviceBeginCommon
std::unique_ptr< SensorCommBasecomm
 
std::unique_ptr< SensorHalhal
 
std::unique_ptr< SensorCommStaticstaticComm
 
uint8_t _addr = 0
 
uint8_t _iface = COMM_CUSTOM
 

Detailed Description

Driver for the TI DRV2605/DRV2604 haptic motor controller.

This driver provides a complete interface for controlling the DRV2605/DRV2604 haptic motor driver IC via I2C. It inherits from HapticBase to provide a unified interface across different haptic drivers.

Supported Features:
  • ROM waveform library playback (117 built-in effects)
  • Waveform sequencing (8 slots)
  • Real-Time Playback (RTP) mode for direct amplitude control
  • Auto-calibration for ERM and LRA actuators
  • Multiple operating modes (internal trigger, external trigger, audio-to-vibe, etc.)
  • ERM and LRA actuator support
Unsupported Features:
  • Runtime gain adjustment (ROM effect intensity is pre-defined)
  • Continuous vibration mode (use RTP mode instead)
  • F0 calibration (use autoCal() instead)
  • VBAT compensation
ROM Library Reference:
  • Library 1: Strong Click (default)
  • Library 2: Sharp Click
  • Library 3: Soft Click
  • Library 4: Medium Click
  • Library 5: Soft Bump
  • Library 6: Double Click
  • Library 7: Triple Click
  • Library 8: Soft Fuzz
  • Library 9: Buzz
  • Library 10: Butterly
  • Library 11: Crash
  • Library 12: Tick
  • Library 13: Pop
  • Library 14: Generic Click
  • Library 15: Generic Snap
  • Library 16: Generic Roll
  • Library 17: Generic Pitch
Note
LRA Library (Library 6) is specifically designed for Linear Resonant Actuators. ERM libraries (1-5) are for Eccentric Rotating Mass motors.
Usage Example:
#include <Wire.h>
void setup() {
Serial.begin(115200);
Wire.begin();
if (!haptic.begin(Wire, DRV2605_SLAVE_ADDRESS)) {
Serial.println("Init failed!");
while (1);
}
// Select LRA library for linear resonant actuator
haptic.selectLibrary(6);
// Play a built-in effect
haptic.playEffect(1); // Strong click
// Or use RTP for direct control
}
@ REAL_TIME_PLAYBACK
RTP mode (direct drive value)
@license MIT License
void setup()
HapticDriver_AW86224 haptic
bool setMode(HapticMode mode) override
Set the operating mode.
bool setRealtimeValue(uint8_t value) override
Set RTP (real-time playback) value.
bool playEffect(HapticEffectId effect) override
Play a haptic effect.
Driver for the TI DRV2605/DRV2604 haptic motor controller.
bool begin(SensorCommCustom::CustomCallback cb, SensorCommCustomHal::CustomHalCallback hal_cb, uint8_t addr)
Initialize the sensor using custom callback interface.
Warning
You must call begin() successfully before using any other API.

Definition at line 115 of file HapticDriver_DRV2605.hpp.

Constructor & Destructor Documentation

◆ HapticDriver_DRV2605()

HapticDriver_DRV2605::HapticDriver_DRV2605 ( )

Construct an uninitialized driver instance.

Definition at line 37 of file HapticDriver_DRV2605.cpp.

References i.

◆ ~HapticDriver_DRV2605()

HapticDriver_DRV2605::~HapticDriver_DRV2605 ( )
override

Destructor.

Deinitializes communication backend if created.

Definition at line 49 of file HapticDriver_DRV2605.cpp.

References end().

Member Function Documentation

◆ autoCal()

int HapticDriver_DRV2605::autoCal ( )

Perform auto-calibration and return compensation result.

Runs the full auto-calibration sequence and returns the compensation value stored in the AUTOCALCOMP register.

Returns
Auto-calibration compensation value (0-255), or -1 on failure.

Definition at line 338 of file HapticDriver_DRV2605.cpp.

References AUTO_CALIBRATE, DeviceBeginCommon::hal, INTERNAL_TRIGGER, isDone(), SensorCommWrapper::readReg(), run(), and setMode().

Referenced by calibrate().

◆ calibrate()

bool HapticDriver_DRV2605::calibrate ( )
overridevirtual

Perform auto-calibration.

Runs the built-in auto-calibration sequence.

Returns
true if successful, false otherwise.

Reimplemented from HapticBase.

Definition at line 274 of file HapticDriver_DRV2605.cpp.

References autoCal().

Referenced by loop(), testAutoDemo(), and testCalibration().

◆ clearSequence()

bool HapticDriver_DRV2605::clearSequence ( )
overridevirtual

Clear the waveform sequence.

Returns
true if successful, false otherwise.

Reimplemented from HapticBase.

Definition at line 153 of file HapticDriver_DRV2605.cpp.

References i, and setWaveform().

Referenced by testSetSequence().

◆ continuousVibration()

void HapticDriver_DRV2605::continuousVibration ( uint32_t  duration_ms,
bool  blocking = true 
)
overridevirtual

Play a continuous vibration for specified duration.

Note
NOT SUPPORTED by DRV2605. This chip plays pre-defined ROM effects and cannot produce true continuous vibration. For amplitude control, use RTP mode instead.
Parameters
duration_msIgnored.
blockingIgnored.

Reimplemented from HapticBase.

Definition at line 135 of file HapticDriver_DRV2605.cpp.

◆ emergencyStop()

void HapticDriver_DRV2605::emergencyStop ( )
overridevirtual

Emergency stop - stops all vibration immediately.

Note
Calls stop() internally.

Reimplemented from HapticBase.

Definition at line 98 of file HapticDriver_DRV2605.cpp.

References stop().

◆ end()

void HapticDriver_DRV2605::end ( )
overridevirtual

Deinitialize the driver and release resources.

Reimplemented from HapticBase.

Definition at line 54 of file HapticDriver_DRV2605.cpp.

References HapticBase::setReady(), and stop().

Referenced by ~HapticDriver_DRV2605().

◆ getActuatorType()

HapticActuatorType HapticDriver_DRV2605::getActuatorType ( ) const
overridevirtual

Get the actuator type.

Returns
HapticActuatorType::ERM or HapticActuatorType::LRA.

Implements HapticBase.

Definition at line 191 of file HapticDriver_DRV2605.cpp.

References ERM, and LRA.

Referenced by loop(), setup(), testActuatorType(), and testInit().

◆ getCapabilities()

HapticCapabilities HapticDriver_DRV2605::getCapabilities ( ) const
overridevirtual

◆ getChipID()

uint8_t HapticDriver_DRV2605::getChipID ( ) const
overridevirtual

Get the chip ID.

Returns
Chip identifier value (shifted from STATUS register).

Implements HapticBase.

Definition at line 184 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

Referenced by setup(), and testInit().

◆ getChipName()

const char * HapticDriver_DRV2605::getChipName ( ) const
overridevirtual

Get the chip name.

Returns
Always returns "DRV2605".

Implements HapticBase.

Definition at line 65 of file HapticDriver_DRV2605.cpp.

Referenced by setup(), and testInit().

◆ getF0()

uint32_t HapticDriver_DRV2605::getF0 ( ) const
overridevirtual

Get the measured resonant frequency (F0).

Note
For LRA mode, reads the resonance period and calculates F0. For ERM mode, this returns 0.
Returns
F0 in Hz, or 0 if not available.

Reimplemented from HapticBase.

Definition at line 285 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

Referenced by testF0().

◆ getGain()

uint8_t HapticDriver_DRV2605::getGain ( ) const
overridevirtual

Get the current gain value.

Note
NOT SUPPORTED by DRV2605. ROM effect intensities are pre-defined.
Returns
Always returns 0.

Implements HapticBase.

Definition at line 114 of file HapticDriver_DRV2605.cpp.

◆ getLRAFrequency()

uint8_t HapticDriver_DRV2605::getLRAFrequency ( ) const

Read the LRA resonance period (for LRA calibration).

Returns
LRA resonance period value (bits 6:0), or 0 if unavailable.

Definition at line 409 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

◆ getMode()

HapticMode HapticDriver_DRV2605::getMode ( ) const
overridevirtual

Get the current operating mode.

Returns
Current HapticMode.

Reimplemented from HapticBase.

Definition at line 251 of file HapticDriver_DRV2605.cpp.

References INTERNAL_TRIGGER, SensorCommWrapper::readReg(), and STANDBY.

Referenced by setup(), testInit(), and testModes().

◆ getRealtimeValue()

uint8_t HapticDriver_DRV2605::getRealtimeValue ( ) const

Get the current RTP value.

Returns
Current RTP register value (0x00 to 0xFF).

Definition at line 268 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

◆ getStatus()

HapticStatus HapticDriver_DRV2605::getStatus ( ) const
overridevirtual

Get current playback status.

Returns
HapticStatus::PLAYING if playing, HapticStatus::IDLE otherwise.

Implements HapticBase.

Definition at line 90 of file HapticDriver_DRV2605.cpp.

References HapticBase::_isReady, ERROR, IDLE, isPlaying(), PLAYING, and STANDBY.

Referenced by testStatus().

◆ getVbat()

uint32_t HapticDriver_DRV2605::getVbat ( )
overridevirtual

Get the battery voltage.

Returns
Voltage in mV, or 0 if unsupported.

Reimplemented from HapticBase.

Definition at line 296 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

Referenced by loop(), setup(), and testInit().

◆ isDone()

bool HapticDriver_DRV2605::isDone ( ) const

Check if playback is done.

Returns
true if GO bit is clear (playback stopped).

Definition at line 317 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

Referenced by autoCal().

◆ isPlaying()

bool HapticDriver_DRV2605::isPlaying ( ) const
overridevirtual

Check if haptic is currently playing.

Returns
true if playing, false otherwise.

Implements HapticBase.

Definition at line 84 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg().

Referenced by getStatus(), and testStop().

◆ isReady()

bool HapticDriver_DRV2605::isReady ( ) const
overridevirtual

Check if the driver is initialized and ready.

Returns
true if ready, false otherwise.

Implements HapticBase.

Definition at line 60 of file HapticDriver_DRV2605.cpp.

References HapticBase::_isReady.

◆ needsCalibration()

bool HapticDriver_DRV2605::needsCalibration ( ) const
overridevirtual

Check if calibration is needed.

Returns
Always returns true for DRV2605.

Reimplemented from HapticBase.

Definition at line 280 of file HapticDriver_DRV2605.cpp.

◆ playEffect()

bool HapticDriver_DRV2605::playEffect ( HapticEffectId  effect)
overridevirtual

Play a haptic effect.

Plays a ROM waveform effect with blocking (waits for completion).

Parameters
effectEffect ID (1-117 based on selected library).
Returns
true if started successfully, false otherwise.

Implements HapticBase.

Definition at line 121 of file HapticDriver_DRV2605.cpp.

References HapticBase::_isReady, run(), and setWaveform().

Referenced by loop(), playEffectAsync(), testAutoDemo(), testLibrarySelection(), testPlayEffect(), testPlayEffectRange(), and testStop().

◆ playEffectAsync()

bool HapticDriver_DRV2605::playEffectAsync ( HapticEffectId  effect)
overridevirtual

Play a haptic effect (non-blocking).

Note
For DRV2605, this behaves the same as playEffect() since the chip handles playback internally.
Parameters
effectEffect ID to play.
Returns
true if started successfully, false otherwise.

Reimplemented from HapticBase.

Definition at line 130 of file HapticDriver_DRV2605.cpp.

References playEffect().

◆ playSequence()

bool HapticDriver_DRV2605::playSequence ( )
overridevirtual

Play the waveform sequence.

Returns
true if successful, false otherwise.

Reimplemented from HapticBase.

Definition at line 162 of file HapticDriver_DRV2605.cpp.

References run().

Referenced by testSetSequence().

◆ run()

bool HapticDriver_DRV2605::run ( )
overridevirtual

Start haptic playback.

Returns
true if successful, false otherwise.

Implements HapticBase.

Definition at line 70 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

Referenced by autoCal(), playEffect(), playSequence(), and trigger().

◆ selectLibrary()

void HapticDriver_DRV2605::selectLibrary ( uint8_t  lib)

Select the ROM waveform library.

Different libraries contain different sets of built-in effects.

Parameters
libLibrary selection:
  • 0: Empty
  • 1..5: ERM libraries (1=Strong Click, 2=Sharp Click, etc.)
  • 6: LRA library (for Linear Resonant Actuators)

Definition at line 311 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

Referenced by loop(), and testLibrarySelection().

◆ setActuatorType()

bool HapticDriver_DRV2605::setActuatorType ( HapticActuatorType  type)
overridevirtual

Set the actuator type.

Automatically selects the appropriate ROM library:

  • ERM: Library 1
  • LRA: Library 6
Parameters
typeActuator type to set (ERM or LRA).
Returns
true if successful, false otherwise.

Implements HapticBase.

Definition at line 196 of file HapticDriver_DRV2605.cpp.

References ERM, SensorCommWrapper::updateBits(), and SensorCommWrapper::writeReg().

Referenced by loop(), setERMLRA(), and testActuatorType().

◆ setAutoBrake()

void HapticDriver_DRV2605::setAutoBrake ( bool  enable)

Enable/disable automatic braking.

When enabled, the chip automatically applies braking after each waveform effect.

Parameters
enabletrue to enable, false to disable.

Definition at line 362 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setBrakeTime()

void HapticDriver_DRV2605::setBrakeTime ( uint8_t  time)

Set the brake time offset.

Controls the braking period after each waveform.

Parameters
timeBrake time offset value (0-255).

Definition at line 380 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

◆ setCtrl4()

void HapticDriver_DRV2605::setCtrl4 ( uint8_t  value)

Set the control4 register value.

Warning
Advanced use only. Incorrect values may cause unpredictable behavior.
Parameters
valueControl4 register value.

Definition at line 404 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

◆ setERMLRA()

void HapticDriver_DRV2605::setERMLRA ( bool  erm)

Enable/disable ERM/LRA mode.

Deprecated:
Use setActuatorType() instead.
Parameters
ermtrue for ERM, false for LRA.

Definition at line 398 of file HapticDriver_DRV2605.cpp.

References ERM, LRA, and setActuatorType().

◆ setGain()

bool HapticDriver_DRV2605::setGain ( uint8_t  gain)
overridevirtual

Set the gain/amplitude.

Note
NOT SUPPORTED by DRV2605. This chip uses ROM waveforms with pre-defined intensities. For amplitude control, use RTP mode (setRealtimeValue) instead.
Parameters
gainIgnored.
Returns
Always returns false.

Implements HapticBase.

Definition at line 103 of file HapticDriver_DRV2605.cpp.

◆ setMode()

bool HapticDriver_DRV2605::setMode ( HapticMode  mode)
overridevirtual

Set the operating mode.

Parameters
modeMode to set:
  • INTERNAL_TRIGGER: Waveform playback triggered by GO bit
  • EXT_TRIGGER_EDGE: External trigger on edge
  • EXT_TRIGGER_LEVEL: External trigger on level
  • PWM_ANALOG: PWM or analog input drive
  • AUDIO_TO_VIBE: Audio input to vibration
  • REAL_TIME_PLAYBACK: Direct RTP amplitude control
  • DIAGNOSTICS: Diagnostics mode
  • AUTO_CALIBRATE: Auto-calibration mode
Returns
true if successful, false otherwise.

Reimplemented from HapticBase.

Definition at line 210 of file HapticDriver_DRV2605.cpp.

References AUDIO_TO_VIBE, AUTO_CALIBRATE, DIAGNOSTICS, EXT_TRIGGER_EDGE, EXT_TRIGGER_LEVEL, INTERNAL_TRIGGER, PWM_ANALOG, REAL_TIME_PLAYBACK, STANDBY, and SensorCommWrapper::writeReg().

Referenced by autoCal(), loop(), testModes(), testNormalMode(), testRTP(), and testStandby().

◆ setOverdriveClamp()

void HapticDriver_DRV2605::setOverdriveClamp ( uint8_t  value)

Set the overdrive clamp voltage for auto-calibration.

This value controls the maximum voltage during auto-calibration.

Parameters
valueOverdrive clamp voltage value.

Definition at line 333 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

◆ setOverdriveTime()

void HapticDriver_DRV2605::setOverdriveTime ( uint8_t  cycles)

Set the number of overdrive cycles.

Controls how long the overdrive period lasts at the beginning of each waveform.

Parameters
cyclesNumber of overdrive cycles (0-255).

Definition at line 375 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

◆ setRatedVoltage()

void HapticDriver_DRV2605::setRatedVoltage ( uint8_t  value)

Set the rated voltage for auto-calibration.

This value should match the rated voltage of your actuator.

Parameters
valueRated voltage value (register value).

Definition at line 328 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

◆ setRealtimeValue()

bool HapticDriver_DRV2605::setRealtimeValue ( uint8_t  value)
overridevirtual

Set RTP (real-time playback) value.

Provides direct amplitude control in RTP mode.

Parameters
valueRTP drive value (0x00 to 0xFF).
Returns
true if successful, false otherwise.

Reimplemented from HapticBase.

Definition at line 263 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

Referenced by loop(), and testRTP().

◆ setRtpOverdrive()

void HapticDriver_DRV2605::setRtpOverdrive ( bool  enable)

Enable/disable RTP overdrive.

When enabled, RTP mode uses overdrive to reach the target amplitude faster.

Parameters
enabletrue to enable, false to disable.

Definition at line 385 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::readReg(), and SensorCommWrapper::writeReg().

◆ setSequence()

bool HapticDriver_DRV2605::setSequence ( uint8_t  slot,
HapticEffectId  effect 
)
overridevirtual

Set a waveform in the sequence.

Parameters
slotSequence slot index (0 to 7).
effectEffect ID to play at this slot.
Returns
true if successful, false otherwise.

Reimplemented from HapticBase.

Definition at line 145 of file HapticDriver_DRV2605.cpp.

References setWaveform().

Referenced by testSetSequence().

◆ setWaveform()

void HapticDriver_DRV2605::setWaveform ( uint8_t  slot,
uint8_t  w 
)

Set a waveform entry in the playback sequence table.

Playback starts at slot 0 and continues sequentially until a value of 0 is encountered, or slot 7 is reached.

Parameters
slotSequence slot index (0..7).
wWaveform index in the device ROM library (0 = end).

Definition at line 306 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

Referenced by clearSequence(), playEffect(), and setSequence().

◆ stop()

bool HapticDriver_DRV2605::stop ( )
overridevirtual

Stop haptic playback immediately.

Returns
true if successful, false otherwise.

Implements HapticBase.

Definition at line 79 of file HapticDriver_DRV2605.cpp.

References SensorCommWrapper::writeReg().

Referenced by emergencyStop(), end(), loop(), testAutoDemo(), testRTP(), and testStop().

◆ trigger()

void HapticDriver_DRV2605::trigger ( )

Trigger a single playback cycle.

Sets the GO bit to start playback of the waveform sequence. Equivalent to run().

Definition at line 323 of file HapticDriver_DRV2605.cpp.

References run().

◆ vibrationUpdate()

void HapticDriver_DRV2605::vibrationUpdate ( )
overridevirtual

Update vibration state (for non-blocking mode).

Note
NOT SUPPORTED. DRV2605 handles playback internally. This function does nothing.

Reimplemented from HapticBase.

Definition at line 141 of file HapticDriver_DRV2605.cpp.


The documentation for this class was generated from the following files: