Drv2605

Struct Drv2605 

Source
pub struct Drv2605<I2C>
where I2C: I2c,
{ /* private fields */ }

Implementations§

Source§

impl<I2C, E> Drv2605<I2C>
where I2C: I2c<Error = E>,

Source

pub fn new(i2c: I2C) -> Self

Construct a driver instance, but don’t do any initialization

Source

pub async fn init_open_loop_erm(&mut self) -> Result<(), E>

Source

pub async fn get_status(&mut self) -> Result<StatusReg, E>

Source

pub async fn get_mode(&mut self) -> Result<ModeReg, E>

Source

pub async fn reset(&mut self) -> Result<(), E>

performs the equivalent operation of power cycling the device. Any playback operations are immediately interrupted, and all registers are reset to the default values.

Source

pub async fn set_standby(&mut self, standby: bool) -> Result<(), E>

Put the device into standby mode, or wake it up from standby

Source

pub async fn set_realtime_playback_input(&mut self, value: i8) -> Result<(), E>

This field is the entry point for real-time playback (RTP) data. The DRV2605 playback engine drives the RTP_INPUT[7:0] value to the load when MODE[2:0] = 5 (RTP mode). The RTP_INPUT[7:0] value can be updated in real-time by the host controller to create haptic waveforms. The RTP_INPUT[7:0] value is interpreted as signed by default, but can be set to unsigned by the DATA_FORMAT_RTP bit in register 0x1D. When the haptic waveform is complete, the user can idle the device by setting MODE[2:0] = 0, or alternatively by setting STANDBY = 1.

Source

pub async fn set_high_impedance_state(&mut self, value: bool) -> Result<(), E>

This bit sets the output driver into a true high-impedance state. The device must be enabled to go into the high-impedance state. When in hardware shutdown or standby mode, the output drivers have 15 kΩ to ground. When the HI_Z bit is asserted, the hi-Z functionality takes effect immediately, even if a transaction is taking place.

Source

pub async fn set_library(&mut self, value: LibrarySelection) -> Result<(), E>

Selects the library the playback engine selects when the GO bit is set.

Source

pub async fn set_waveform( &mut self, waveform: &[WaveformReg; 8], ) -> Result<(), E>

Sets the waveform generation registers to the shape provided

Source

pub async fn set_single_effect(&mut self, effect: Effect) -> Result<(), E>

Source

pub async fn set_go(&mut self, go: bool) -> Result<(), E>

This bit is used to fire processes in the DRV2605 device. The process fired by the GO bit is selected by the MODE[2:0] bit (register 0x01). The primary function of this bit is to fire playback of the waveform identifiers in the waveform sequencer (registers 0x04 to 0x0B), in which case, this bit can be thought of a software trigger for haptic waveforms. The GO bit remains high until the playback of the haptic waveform sequence is complete. Clearing the GO bit during waveform playback cancels the waveform sequence. Using one of the external trigger modes can cause the GO bit to be set or cleared by the external trigger pin. This bit can also be used to fire the auto-calibration process or the diagnostic process.

Source

pub async fn set_overdrive_time_offset(&mut self, value: i8) -> Result<(), E>

This bit adds a time offset to the overdrive portion of the library waveforms. Some motors require more overdrive time than others, so this register allows the user to add or remove overdrive time from the library waveforms. The maximum voltage value in the library waveform is automatically determined to be the overdrive portion. This register is only useful in open-loop mode. Overdrive is automatic for closed-loop mode. The offset is interpreted as 2s complement, so the time offset may be positive or negative. Overdrive Time Offset (ms) = ODT[7:0] × PLAYBACK_INTERVAL See the section for PLAYBACK_INTERVAL details.

Source

pub async fn set_sustain_time_offset_positive( &mut self, value: i8, ) -> Result<(), E>

This bit adds a time offset to the positive sustain portion of the library waveforms. Some motors have a faster or slower response time than others, so this register allows the user to add or remove positive sustain time from the library waveforms. Any positive voltage value other than the overdrive portion is considered as a sustain positive value. The offset is interpreted as 2s complement, so the time offset can positive or negative. Sustain-Time Positive Offset (ms) = SPT[7:0] × PLAYBACK_INTERVAL See the section for PLAYBACK_INTERVAL details.

Source

pub async fn set_sustain_time_offset_negative( &mut self, value: i8, ) -> Result<(), E>

This bit adds a time offset to the negative sustain portion of the library waveforms. Some motors have a faster or slower response time than others, so this register allows the user to add or remove negative sustain time from the library waveforms. Any negative voltage value other than the overdrive portion is considered as a sustaining negative value. The offset is interpreted as two’s complement, so the time offset can be positive or negative. Sustain-Time Negative Offset (ms) = SNT[7:0] × PLAYBACK_INTERVAL See the section for PLAYBACK_INTERVAL details.

Source

pub async fn set_brake_time_offset(&mut self, value: i8) -> Result<(), E>

This bit adds a time offset to the braking portion of the library waveforms. Some motors require more braking time than others, so this register allows the user to add or take away brake time from the library waveforms. The most negative voltage value in the library waveform is automatically determined to be the braking portion. This register is only useful in open-loop mode. Braking is automatic for closed-loop mode. The offset is interpreted as 2s complement, so the time offset can be positive or negative. Brake Time Offset (ms) = BRT[7:0] × PLAYBACK_INTERVAL See the section for PLAYBACK_INTERVAL details.

Auto Trait Implementations§

§

impl<I2C> Freeze for Drv2605<I2C>
where I2C: Freeze,

§

impl<I2C> RefUnwindSafe for Drv2605<I2C>
where I2C: RefUnwindSafe,

§

impl<I2C> Send for Drv2605<I2C>
where I2C: Send,

§

impl<I2C> Sync for Drv2605<I2C>
where I2C: Sync,

§

impl<I2C> Unpin for Drv2605<I2C>
where I2C: Unpin,

§

impl<I2C> UnwindSafe for Drv2605<I2C>
where I2C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.