Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

DRV2605 Haptic Driver for ERM and LRA. More...

Files

file  drv2605.h
 Header file providing the API for the DRV2605 haptic driver.
 

Data Structures

struct  drv2605_rom_data
 ROM data configuration. More...
 
struct  drv2605_rtp_data
 Real-Time Playback (RTP) data configuration. More...
 
union  drv2605_config_data
 Configuration data union. More...
 

Enumerations

enum  drv2605_library {
  DRV2605_LIBRARY_EMPTY = 0 , DRV2605_LIBRARY_TS2200_A , DRV2605_LIBRARY_TS2200_B , DRV2605_LIBRARY_TS2200_C ,
  DRV2605_LIBRARY_TS2200_D , DRV2605_LIBRARY_TS2200_E , DRV2605_LIBRARY_LRA
}
 Effect libraries. More...
 
enum  drv2605_mode {
  DRV2605_MODE_INTERNAL_TRIGGER = 0 , DRV2605_MODE_EXTERNAL_EDGE_TRIGGER , DRV2605_MODE_EXTERNAL_LEVEL_TRIGGER , DRV2605_MODE_PWM_ANALOG_INPUT ,
  DRV2605_MODE_AUDIO_TO_VIBE , DRV2605_MODE_RTP , DRV2605_MODE_DIAGNOSTICS , DRV2605_MODE_AUTO_CAL
}
 Modes of operation. More...
 
enum  drv2605_haptics_source {
  DRV2605_HAPTICS_SOURCE_ROM , DRV2605_HAPTICS_SOURCE_RTP , DRV2605_HAPTICS_SOURCE_AUDIO , DRV2605_HAPTICS_SOURCE_PWM ,
  DRV2605_HAPTICS_SOURCE_ANALOG
}
 Types of haptic signal sources. More...
 

Functions

int drv2605_haptic_config (const struct device *dev, enum drv2605_haptics_source source, const union drv2605_config_data *config_data)
 Configure the DRV2605 device for a particular signal source.
 

Helpers

#define DRV2605_WAVEFORM_SEQUENCER_MAX   8
 Maximum number of waveforms that can be stored in the sequencer.
 
#define DRV2605_WAVEFORM_SEQUENCER_WAIT_MS(ms)   (0x80 | ((ms) / 10))
 Creates a wait/delay value for the waveform sequencer.
 

Detailed Description

DRV2605 Haptic Driver for ERM and LRA.

Macro Definition Documentation

◆ DRV2605_WAVEFORM_SEQUENCER_MAX

#define DRV2605_WAVEFORM_SEQUENCER_MAX   8

#include <include/zephyr/drivers/haptics/drv2605.h>

Maximum number of waveforms that can be stored in the sequencer.

◆ DRV2605_WAVEFORM_SEQUENCER_WAIT_MS

#define DRV2605_WAVEFORM_SEQUENCER_WAIT_MS (   ms)    (0x80 | ((ms) / 10))

#include <include/zephyr/drivers/haptics/drv2605.h>

Creates a wait/delay value for the waveform sequencer.

This macro generates a byte value that, when placed in the drv2605_rom_data::seq_regs array, instructs the DRV2605 playback engine to idle for a specified duration.

Parameters
msThe desired delay in milliseconds (rounded down to the nearest 10ms). Valid range is 10 to 1270.
Returns
A byte literal representing the wait time for the sequencer.

Enumeration Type Documentation

◆ drv2605_haptics_source

#include <include/zephyr/drivers/haptics/drv2605.h>

Types of haptic signal sources.

This enumeration defines the different types of haptic signal sources supported by the DRV2605.

Enumerator
DRV2605_HAPTICS_SOURCE_ROM 

Playback from the pre-programmed ROM library.

DRV2605_HAPTICS_SOURCE_RTP 

Playback from Real-Time Playback (RTP) data stream.

DRV2605_HAPTICS_SOURCE_AUDIO 

Playback is generated from an audio signal.

DRV2605_HAPTICS_SOURCE_PWM 

Playback is driven by an external PWM signal.

DRV2605_HAPTICS_SOURCE_ANALOG 

Playback is driven by an external analog signal.

◆ drv2605_library

#include <include/zephyr/drivers/haptics/drv2605.h>

Effect libraries.

This enumeration defines the different effect libraries that can be used with the DRV2605 when using ROM source. TouchSense 2220 libraries are for open-loop ERM motors, DRV2605_LIBRARY_LRA is to be used for closed-loop LRA motors.

Enumerator
DRV2605_LIBRARY_EMPTY 

Empty library.

DRV2605_LIBRARY_TS2200_A 

TouchSense 2220 A library.

DRV2605_LIBRARY_TS2200_B 

TouchSense 2220 B library.

DRV2605_LIBRARY_TS2200_C 

TouchSense 2220 C library.

DRV2605_LIBRARY_TS2200_D 

TouchSense 2220 D library.

DRV2605_LIBRARY_TS2200_E 

TouchSense 2220 E library.

DRV2605_LIBRARY_LRA 

Linear Resonance Actuator (LRA) library.

◆ drv2605_mode

#include <include/zephyr/drivers/haptics/drv2605.h>

Modes of operation.

This enumeration defines the different modes of operation supported by the DRV2605.

See Table 5 of the DRV2605 datasheet for more information on the various operation modes.

Enumerator
DRV2605_MODE_INTERNAL_TRIGGER 

Internal trigger mode.

DRV2605_MODE_EXTERNAL_EDGE_TRIGGER 

External trigger mode (edge)

DRV2605_MODE_EXTERNAL_LEVEL_TRIGGER 

External trigger mode (level)

DRV2605_MODE_PWM_ANALOG_INPUT 

PWM or Analog input mode.

DRV2605_MODE_AUDIO_TO_VIBE 

Audio-to-vibe mode.

DRV2605_MODE_RTP 

RTP mode.

DRV2605_MODE_DIAGNOSTICS 

Diagnostics mode.

DRV2605_MODE_AUTO_CAL 

Auto-calibration mode.

Function Documentation

◆ drv2605_haptic_config()

int drv2605_haptic_config ( const struct device dev,
enum drv2605_haptics_source  source,
const union drv2605_config_data config_data 
)

#include <include/zephyr/drivers/haptics/drv2605.h>

Configure the DRV2605 device for a particular signal source.

Parameters
devPointer to the device structure for haptic device instance
sourceThe type of haptic signal source desired
config_dataPointer to the configuration data union for the source
Return values
0success
-ENOTSUPsignal source not supported
-errnoanother negative error code on failure