embassy-drv2605l 0.1.0

Embassy-rs async driver for DRV2605L haptic driver
Documentation
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error<E> {
    I2c(E),
    InvalidParameter,
    CalibrationFailed,
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Mode {
    InternalTrigger = 0x00,
    ExternalTriggerEdge = 0x01,
    ExternalTriggerLevel = 0x02,
    PwmOrAnalogInput = 0x03,
    AudioToVibe = 0x04,
    RealTimePlayback = 0x05,
    Diagnostics = 0x06,
    AutoCalibration = 0x07,
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MotorType {
    ERM,
    LRA,
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Library {
    Empty = 0,
    LibraryA = 1,
    LibraryB = 2,
    LibraryC = 3,
    LibraryD = 4,
    LibraryE = 5,
    LRA = 6,
}

#[repr(u8)]
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Effect {
    StrongClick100 = 1,
    StrongClick60 = 2,
    StrongClick30 = 3,
    SharpClick100 = 4,
    SharpClick60 = 5,
    SharpClick30 = 6,
    SoftBump100 = 7,
    SoftBump60 = 8,
    SoftBump30 = 9,
    DoubleClick100 = 10,
    DoubleClick60 = 11,
    TripleClick100 = 12,
    SoftFuzz60 = 13,
    StrongBuzz100 = 14,
    Alert750ms = 15,
    Alert1000ms = 16,
    StrongClick1_100 = 17,
    StrongClick2_80 = 18,
    StrongClick3_60 = 19,
    StrongClick4_30 = 20,
    MediumClick1_100 = 21,
    MediumClick2_80 = 22,
    MediumClick3_60 = 23,
    SharpTick1_100 = 24,
    SharpTick2_80 = 25,
    SharpTick3_60 = 26,
    ShortDoubleClickStrong1_100 = 27,
    ShortDoubleClickStrong2_80 = 28,
    ShortDoubleClickStrong3_60 = 29,
    ShortDoubleClickStrong4_30 = 30,
    ShortDoubleClickMedium1_100 = 31,
    ShortDoubleClickMedium2_80 = 32,
    ShortDoubleClickMedium3_60 = 33,
    ShortDoubleSharpTick1_100 = 34,
    ShortDoubleSharpTick2_80 = 35,
    ShortDoubleSharpTick3_60 = 36,
    LongDoubleSharpClickStrong1_100 = 37,
    LongDoubleSharpClickStrong2_80 = 38,
    LongDoubleSharpClickStrong3_60 = 39,
    LongDoubleSharpClickStrong4_30 = 40,
    LongDoubleSharpClickMedium1_100 = 41,
    LongDoubleSharpClickMedium2_80 = 42,
    LongDoubleSharpClickMedium3_60 = 43,
    LongDoubleSharpTick1_100 = 44,
    LongDoubleSharpTick2_80 = 45,
    LongDoubleSharpTick3_60 = 46,
    Buzz1_100 = 47,
    Buzz2_80 = 48,
    Buzz3_60 = 49,
    Buzz4_40 = 50,
    Buzz5_20 = 51,
    PulsingStrong1_100 = 52,
    PulsingStrong2_60 = 53,
    PulsingMedium1_100 = 54,
    PulsingMedium2_60 = 55,
    PulsingSharp1_100 = 56,
    PulsingSharp2_60 = 57,
    TransitionClick1_100 = 58,
    TransitionClick2_80 = 59,
    TransitionClick3_60 = 60,
    TransitionClick4_40 = 61,
    TransitionClick5_20 = 62,
    TransitionClick6_10 = 63,
    TransitionHum1_100 = 64,
    TransitionHum2_80 = 65,
    TransitionHum3_60 = 66,
    TransitionHum4_40 = 67,
    TransitionHum5_20 = 68,
    TransitionHum6_10 = 69,
    TransitionRampDownLongSmooth1_100 = 70,
    TransitionRampDownLongSmooth2_100 = 71,
    TransitionRampDownMediumSmooth1_100 = 72,
    TransitionRampDownMediumSmooth2_100 = 73,
    TransitionRampDownShortSmooth1_100 = 74,
    TransitionRampDownShortSmooth2_100 = 75,
    TransitionRampDownLongSharp1_100 = 76,
    TransitionRampDownLongSharp2_100 = 77,
    TransitionRampDownMediumSharp1_100 = 78,
    TransitionRampDownMediumSharp2_100 = 79,
    TransitionRampDownShortSharp1_100 = 80,
    TransitionRampDownShortSharp2_100 = 81,
    TransitionRampUpLongSmooth1_100 = 82,
    TransitionRampUpLongSmooth2_100 = 83,
    TransitionRampUpMediumSmooth1_100 = 84,
    TransitionRampUpMediumSmooth2_100 = 85,
    TransitionRampUpShortSmooth1_100 = 86,
    TransitionRampUpShortSmooth2_100 = 87,
    TransitionRampUpLongSharp1_100 = 88,
    TransitionRampUpLongSharp2_100 = 89,
    TransitionRampUpMediumSharp1_100 = 90,
    TransitionRampUpMediumSharp2_100 = 91,
    TransitionRampUpShortSharp1_100 = 92,
    TransitionRampUpShortSharp2_100 = 93,
    TransitionRampDownLongSmooth1_50 = 94,
    TransitionRampDownLongSmooth2_50 = 95,
    TransitionRampDownMediumSmooth1_50 = 96,
    TransitionRampDownMediumSmooth2_50 = 97,
    TransitionRampDownShortSmooth1_50 = 98,
    TransitionRampDownShortSmooth2_50 = 99,
    TransitionRampDownLongSharp1_50 = 100,
    TransitionRampDownLongSharp2_50 = 101,
    TransitionRampDownMediumSharp1_50 = 102,
    TransitionRampDownMediumSharp2_50 = 103,
    TransitionRampDownShortSharp1_50 = 104,
    TransitionRampDownShortSharp2_50 = 105,
    TransitionRampUpLongSmooth1_50 = 106,
    TransitionRampUpLongSmooth2_50 = 107,
    TransitionRampUpMediumSmooth1_50 = 108,
    TransitionRampUpMediumSmooth2_50 = 109,
    TransitionRampUpShortSmooth1_50 = 110,
    TransitionRampUpShortSmooth2_50 = 111,
    TransitionRampUpLongSharp1_50 = 112,
    TransitionRampUpLongSharp2_50 = 113,
    TransitionRampUpMediumSharp1_50 = 114,
    TransitionRampUpMediumSharp2_50 = 115,
    TransitionRampUpShortSharp1_50 = 116,
    TransitionRampUpShortSharp2_50 = 117,
    LongBuzz100 = 118,
    SmoothHum1_50 = 119,
    SmoothHum2_40 = 120,
    SmoothHum3_30 = 121,
    SmoothHum4_20 = 122,
    SmoothHum5_10 = 123,
}

impl Effect {
    pub fn as_u8(self) -> u8 {
        self as u8
    }
}

pub const DRV2605L_ADDR: u8 = 0x5A;