| Crates.io | embassy-drv2605l |
| lib.rs | embassy-drv2605l |
| version | 0.1.0 |
| created_at | 2025-07-10 18:38:05.905083+00 |
| updated_at | 2025-07-10 18:38:05.905083+00 |
| description | Embassy-rs async driver for DRV2605L haptic driver |
| homepage | |
| repository | https://github.com/yourusername/embassy-drv2605l |
| max_upload_size | |
| id | 1746919 |
| size | 32,328 |
Driver for the DRV2605L haptic motor controller with both blocking and async I2C support.
no_std compatible: For embedded systemsdefmt: Debug support when needed[dependencies]
# For async (default)
embassy-drv2605l = "0.1.0"
# For blocking only
embassy-drv2605l = { version = "0.1.0", default-features = false, features = ["blocking"] }
# For both blocking and async
embassy-drv2605l = { version = "0.1.0", features = ["blocking", "async"] }
use embassy_drv2605l::{Drv2605l, Effect};
let mut haptic = Drv2605l::new(i2c);
haptic.init().await?;
// Play a click
haptic.play_waveform(Effect::StrongClick100.as_u8()).await?;
use embassy_drv2605l::{Drv2605l, Effect};
let mut haptic = Drv2605l::new(i2c);
haptic.init()?;
// Play a click
haptic.play_waveform(Effect::StrongClick100.as_u8())?;
use embassy_drv2605l::{Drv2605l, MotorType};
let mut haptic = Drv2605l::new(i2c);
haptic.set_motor_type(MotorType::ERM).await?; // Default is LRA
haptic.init().await?;
// Chain multiple effects
haptic.clear_waveform_sequence().await?;
haptic.set_waveform(0, Effect::StrongClick100.as_u8()).await?;
haptic.set_waveform(1, 0x81).await?; // 10ms pause
haptic.set_waveform(2, Effect::DoubleClick60.as_u8()).await?;
haptic.set_waveform(3, 0).await?; // End marker
haptic.go().await?;
// Custom intensity control
haptic.set_mode(Mode::RealTimePlayback).await?;
haptic.set_rtp_input(0x7F).await?; // 50% intensity
haptic.set_rtp_input(0xFF).await?; // Full intensity
haptic.set_rtp_input(0x00).await?; // Stop
StrongClick100, SharpClick60, SoftBump100DoubleClick100, TripleClick100, Alert750msTransitionRampUpShortSmooth1_100StrongBuzz100, SmoothHum1_50123 effects total - see Effect enum for complete list.
Insert delays between effects: 0x80 | (delay_ms / 10)
haptic.set_waveform(1, 0x81).await?; // 10ms
haptic.set_waveform(2, 0x8A).await?; // 100ms
haptic.set_waveform(3, 0xFF).await?; // 1270ms (max)
I2C Connection (Address: 0x5A)
Motor Types
MIT OR Apache-2.0