Introduction

Documentation Status Discord

CircuitPython module for the DRV2605 haptic feedback motor driver.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Usage Example

See examples/simpletest.py for a demo of the usage.

API Reference

Adafruit_DRV2605

CircuitPython module for the DRV2605 haptic feedback motor driver. See examples/simpletest.py for a demo of the usage.

  • Author(s): Tony DiCola
class adafruit_drv2605.DRV2605(i2c, address=<sphinx.ext.autodoc._MockObject object>)[source]

TI DRV2605 haptic feedback motor driver module.

library

Get and set the library selected for waveform playback. Should be a value of: - LIBRARY_EMPTY: Empty - LIBRARY_TS2200A: TS2200 library A (the default) - LIBRARY_TS2200B: TS2200 library B - LIBRARY_TS2200C: TS2200 library C - LIBRARY_TS2200D: TS2200 library D - LIBRARY_TS2200E: TS2200 library E - LIBRARY_LRA: LRA library See the datasheet for the meaning and description of effects in each library.

mode
Get and set the mode of the chip. Should be a value of:
  • MODE_INTTRIG: Internal triggering, vibrates as soon as you call play(). Default mode.
  • MODE_EXTTRIGEDGE: External triggering, edge mode.
  • MODE_EXTTRIGLVL: External triggering, level mode.
  • MODE_PWMANALOG: PWM/analog input mode.
  • MODE_AUDIOVIBE: Audio-to-vibration mode.
  • MODE_REALTIME: Real-time playback mode.
  • MODE_DIAGNOS: Diagnostics mode.
  • MODE_AUTOCAL: Auto-calibration mode.

See the datasheet for the meaning of modes beyond MODE_INTTRIG.

play()[source]

Play back the select effect(s) on the motor.

set_waveform(effect_id, slot=0)[source]

Select an effect waveform for the specified slot (default is slot 0, but up to 7 effects can be combined with slot values 0 to 6). See the datasheet for a complete table of effect ID values and the associated waveform / effect.

stop()[source]

Stop vibrating the motor.

use_ERM()[source]

Use an eccentric rotating mass motor (the default).

use_LRM()[source]

Use a linear resonance actuator motor.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Building locally

To build this library locally you’ll need to install the circuitpython-build-tools package.

python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools

Once installed, make sure you are in the virtual environment:

source .env/bin/activate

Then run the build:

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-drv2605 --library_location .