Akash Vibhute / DRV2665
Embed: (wiki syntax)

« Back to documentation index

DRV2665_DIGITAL Class Reference

DRV2665_DIGITAL Class Reference

DRV2665_DIGITAL class. More...

#include <drv2665.h>

Public Member Functions

 DRV2665_DIGITAL (PinName sda, PinName scl)
 Create a DRV2665_DIGITAL instance connected to specified I2C pins with specified address.
void init (uint8_t output_gain, uint8_t idle_timeout)
 Initializing DRV2665 in digital mode.
void reset ()
 Reset DRV2665.
void outputWave (int8_t waveform[], uint8_t length)
 Output waveform.
void outputSine (uint16_t hz)
 Output sine.
bool fifo_check ()
 Check FIFO status.
void en_override (uint8_t en)
 Override boot converter.

Detailed Description

DRV2665_DIGITAL class.

DESCRIPTION

DRV2665: Piezo Haptic Driver with Integrated Boost Converter and Digital Front End The DRV2665 device is a piezo haptic driver with integrated 105-V boost switch, integrated power diode, integrated fully-differential amplifier, and integrated digital front end. This versatile device is capable of driving both high-voltage and low-voltage piezo haptic actuators. The input signal can be driven as haptic packets over the I2C port or through the analog inputs

The digital interface of the DRV2665 device is available through an I2C compatible bus. A digital interface relieves the costly processor burden of the PWM generation or additional analog channel requirements in the host system. Any writes to the internal first-in, first-out buffer (FIFO) will automatically wake up the device and begin playing the waveform after the 2 ms internal start-up procedure. When the data flow stops or the FIFO under-runs, the DRV2665 device will automatically enter a pop-less shutdown procedure.

The boost voltage is set using two external resistors, and the boost current limit is programmable through the REXT resistor. A typical start-up time of 2 ms makes the DRV2665 device an ideal piezo driver for fast haptic responses. Thermal overload protection prevents the device from being damaged when overdriven.

Datasheet for DRV2665 can be found at: http://www.ti.com/lit/gpn/drv2665

Example:

  #include "mbed.h"
  #include "DRV2665.h"
  
  DRV2665_DIGITAL piezo(I2C_SDA, I2C_SCL); // DRV2665 digital mode object
  
  int main()
  {
      piezo.init(DRV2665_100_VPP_GAIN, DRV2665_5_MS_IDLE_TOUT); // set output level to 100Vpp and idle timeout to 5ms

      while(1) {
          
          piezo.outputSine(8000); // outputs 8khz sine waveform at selected voltage level

          wait_ms(1);
      }
  }

Definition at line 123 of file drv2665.h.


Constructor & Destructor Documentation

DRV2665_DIGITAL ( PinName  sda,
PinName  scl 
)

Create a DRV2665_DIGITAL instance connected to specified I2C pins with specified address.

Parameters:
sdaI2C-bus SDA pin
sclI2C-bus SCL pin

Definition at line 28 of file drv2665.cpp.


Member Function Documentation

void en_override ( uint8_t  en )

Override boot converter.

To override boot converter to be enabled indefinitely (-> true) or controlled by device logic (-> false)

Definition at line 127 of file drv2665.cpp.

bool fifo_check (  )

Check FIFO status.

returns the status of the FIFO buffer, false -> FIFO is full, true otherwise

Definition at line 116 of file drv2665.cpp.

void init ( uint8_t  output_gain,
uint8_t  idle_timeout 
)

Initializing DRV2665 in digital mode.

Switch to commended downstream I2C channel

Parameters:
output_gainsets the output voltage level
idle_timeoutsets the idle timeout in ms

Definition at line 35 of file drv2665.cpp.

void outputSine ( uint16_t  hz )

Output sine.

Writes sinewave values to FIFO buffer

Parameters:
hzcontains the frequency in hz of the waveform

Definition at line 80 of file drv2665.cpp.

void outputWave ( int8_t  waveform[],
uint8_t  length 
)

Output waveform.

Writes custom output waveform to FIFO (100 bytes max), which is played back at 8kHz

Parameters:
waveform[]contains the waveform values
lengthtells the function how many values makeup the wave

Definition at line 50 of file drv2665.cpp.

void reset (  )

Reset DRV2665.

Reset piezo driver

Definition at line 45 of file drv2665.cpp.