Adafruit DRV2605 Library
Public Member Functions | List of all members
Adafruit_DRV2605 Class Reference

The DRV2605 driver class. More...

#include <Adafruit_DRV2605.h>

Public Member Functions

 Adafruit_DRV2605 (void)
 Instantiates a new DRV2605 class. I2C, no address adjustments or pins.
 
bool begin (TwoWire *theWire=&Wire)
 Setup HW using a specified Wire. More...
 
bool init ()
 Setup the HW. More...
 
void writeRegister8 (uint8_t reg, uint8_t val)
 Write an 8-bit register. More...
 
uint8_t readRegister8 (uint8_t reg)
 Read an 8-bit register. More...
 
void setWaveform (uint8_t slot, uint8_t w)
 Select the haptic waveform to use. More...
 
void selectLibrary (uint8_t lib)
 Select the waveform library to use. More...
 
void go (void)
 Start playback of the waveforms (start moving!).
 
void stop (void)
 Stop playback.
 
void setMode (uint8_t mode)
 Set the device mode. More...
 
void setRealtimeValue (uint8_t rtp)
 Set the realtime value when in RTP mode, used to directly drive the haptic motor. More...
 
void useERM ()
 Use ERM (Eccentric Rotating Mass) mode.
 
void useLRA ()
 Use LRA (Linear Resonance Actuator) mode.
 

Detailed Description

The DRV2605 driver class.

Member Function Documentation

◆ begin()

bool Adafruit_DRV2605::begin ( TwoWire *  theWire = &Wire)

Setup HW using a specified Wire.

Parameters
theWirePointer to a TwoWire object, defaults to &Wire
Returns
Return value from init()

◆ init()

bool Adafruit_DRV2605::init ( )

Setup the HW.

Returns
Always true

◆ writeRegister8()

void Adafruit_DRV2605::writeRegister8 ( uint8_t  reg,
uint8_t  val 
)

Write an 8-bit register.

Parameters
regThe register to write.
valThe value to write.

◆ readRegister8()

uint8_t Adafruit_DRV2605::readRegister8 ( uint8_t  reg)

Read an 8-bit register.

Parameters
regThe register to read.
Returns
8-bit value of the register.

◆ setWaveform()

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

Select the haptic waveform to use.

Parameters
slotThe waveform slot to set, from 0 to 7
wThe waveform sequence value, refers to an index in the ROM library.

Playback starts at slot 0 and continues through to slot 7, stopping if it encounters a value of 0. A list of available waveforms can be found in section 11.2 of the datasheet: http://www.adafruit.com/datasheets/DRV2605.pdf

◆ selectLibrary()

void Adafruit_DRV2605::selectLibrary ( uint8_t  lib)

Select the waveform library to use.

Parameters
libLibrary to use, 0 = Empty, 1-5 are ERM, 6 is LRA.

See section 7.6.4 in the datasheet for more details: http://www.adafruit.com/datasheets/DRV2605.pdf

◆ setMode()

void Adafruit_DRV2605::setMode ( uint8_t  mode)

Set the device mode.

Parameters
modeMode value, see datasheet section 7.6.2: http://www.adafruit.com/datasheets/DRV2605.pdf

0: Internal trigger, call go() to start playback
1: External trigger, rising edge on IN pin starts playback
2: External trigger, playback follows the state of IN pin
3: PWM/analog input
4: Audio
5: Real-time playback
6: Diagnostics
7: Auto calibration

◆ setRealtimeValue()

void Adafruit_DRV2605::setRealtimeValue ( uint8_t  rtp)

Set the realtime value when in RTP mode, used to directly drive the haptic motor.

Parameters
rtp8-bit drive value.

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