taku hachisu / DRV2605

Dependents:   sonar_vibrator

Embed: (wiki syntax)

« Back to documentation index

DRV2605 Class Reference

DRV2605 Class Reference

Library for the TI DRV2605. More...

#include <DRV2605.h>

Public Member Functions

 DRV2605 (I2C &i2c, ActuatorType at=ERM, BrakeFactor bf=x4, LoopGain lg=MEDIUM, uint8_t rv=0x3F, uint8_t ocv=0x89, AutoCalTime act=ms500_700, uint8_t dt=0x13, SampleTime st=us200, uint8_t bt=2, uint8_t it=2)
 Create a DRV2605 object.
void i2cWriteByte (char reg, char value)
 Write value to register.
uint8_t i2cReadByte (char reg)
 Read value from register.
void mode (uint8_t mode)
 Set the device into specified mode.
uint8_t diagnostics ()
 Runs diagnostics.
void dataFormatRTP (bool isSigned)
 Select the input data interpretation for RTP.
void setLibrary (uint8_t lib)
 Set ROM Library.
void setWaveform (int effect)
 Set single waveform from ROM Library.
void setWaveformSequence (int effect1=0, int effect2=0, int effect3=0, int effect4=0, int effect5=0, int effect6=0, int effect7=0, int effect8=0)
 Set waveform Sequence.
void play ()
 Plays the currently loaded waveform or waveform sequence.
void stop ()
 Stops the currently loaded waveform or waveform sequence.
void playRtp (uint8_t rtp)
 Real time play back.
float batteryVoltage (void)
 Battery voltage monitor.

Detailed Description

Library for the TI DRV2605.

Definition at line 74 of file DRV2605.h.


Constructor & Destructor Documentation

DRV2605 ( I2C &  i2c,
ActuatorType  at = ERM,
BrakeFactor  bf = x4,
LoopGain  lg = MEDIUM,
uint8_t  rv = 0x3F,
uint8_t  ocv = 0x89,
AutoCalTime  act = ms500_700,
uint8_t  dt = 0x13,
SampleTime  st = us200,
uint8_t  bt = 2,
uint8_t  it = 2 
)

Create a DRV2605 object.

Parameters:
&i2cpointer of I2C object
atactuator type
bfbrake factor
lgloop gain
rvrated voltage
ocvoverdirve clamp voltage
actauto caliblration time
dtdrive time
stsample time
btbraking time
itcurrent dissipation time

Definition at line 3 of file DRV2605.cpp.


Member Function Documentation

float batteryVoltage ( void   )

Battery voltage monitor.

Returns:
battery voltage

Definition at line 125 of file DRV2605.cpp.

void dataFormatRTP ( bool  isSigned )

Select the input data interpretation for RTP.

Parameters:
isSignedtrue: singed(-127~127), false: unsigned (0~255)

Definition at line 75 of file DRV2605.cpp.

uint8_t diagnostics (  )

Runs diagnostics.

Returns:
Results of the diagnostics

Definition at line 66 of file DRV2605.cpp.

uint8_t i2cReadByte ( char  reg )

Read value from register.

Parameters:
regRegister to read
Returns:
Value

Definition at line 52 of file DRV2605.cpp.

void i2cWriteByte ( char  reg,
char  value 
)

Write value to register.

Parameters:
regRegister to write
valueValue to write to the register

Definition at line 46 of file DRV2605.cpp.

void mode ( uint8_t  mode )

Set the device into specified mode.

Parameters:
modeMode to set

Definition at line 61 of file DRV2605.cpp.

void play (  )

Plays the currently loaded waveform or waveform sequence.

Definition at line 110 of file DRV2605.cpp.

void playRtp ( uint8_t  rtp )

Real time play back.

Parameters:
rtpintensity of the vibration (0 - 255)

Definition at line 120 of file DRV2605.cpp.

void setLibrary ( uint8_t  lib )

Set ROM Library.

Note: This should be called before setWaveform function

Parameters:
libSet library (see library's macro)

Definition at line 84 of file DRV2605.cpp.

void setWaveform ( int  effect )

Set single waveform from ROM Library.

Note: This should be called after setLibrary function

Parameters:
effectThe Waveform Effect Library Index value to play (1 to 123)

Definition at line 89 of file DRV2605.cpp.

void setWaveformSequence ( int  effect1 = 0,
int  effect2 = 0,
int  effect3 = 0,
int  effect4 = 0,
int  effect5 = 0,
int  effect6 = 0,
int  effect7 = 0,
int  effect8 = 0 
)

Set waveform Sequence.

Note: This should be called after setLibrary function

Parameters:
effect1...effect8 The Waveform Effect Library Index value to play (1 to 123): 0 = Stop Condition; 1- 123 = Waveform Index

Definition at line 95 of file DRV2605.cpp.

void stop (  )

Stops the currently loaded waveform or waveform sequence.

Definition at line 115 of file DRV2605.cpp.