pub struct Vibro<I2C> { /* private fields */ }Expand description
Implementations§
Source§impl<I2C, E> Vibro<I2C>where
I2C: I2c<Error = E>,
impl<I2C, E> Vibro<I2C>where
I2C: I2c<Error = E>,
Sourcepub const DEFAULT_FREQUENCY: u32 = 1000
pub const DEFAULT_FREQUENCY: u32 = 1000
Default vibration frequency in Hz.
Sourcepub fn new_with_address(i2c: I2C, address: u8) -> Result<Self, E>
pub fn new_with_address(i2c: I2C, address: u8) -> Result<Self, E>
Create a new Vibro instance with a custom address.
Sourcepub fn set_frequency(&mut self, frequency: u32)
pub fn set_frequency(&mut self, frequency: u32)
Set the vibration frequency.
Sourcepub fn on(&mut self, duration_ms: u16, power: PowerLevel) -> Result<(), E>
pub fn on(&mut self, duration_ms: u16, power: PowerLevel) -> Result<(), E>
Turn on the vibration motor.
§Arguments
duration_ms- Duration in milliseconds (0xFFFF for indefinite)power- Power level
Sourcepub fn on_with_power(&mut self, duration_ms: u16, power: u8) -> Result<(), E>
pub fn on_with_power(&mut self, duration_ms: u16, power: u8) -> Result<(), E>
Turn on the vibration motor with a custom power level.
§Arguments
duration_ms- Duration in milliseconds (0xFFFF for indefinite)power- Power level (0-100)
Sourcepub fn on_continuous(&mut self, power: PowerLevel) -> Result<(), E>
pub fn on_continuous(&mut self, power: PowerLevel) -> Result<(), E>
Turn on the vibration motor indefinitely.
Auto Trait Implementations§
impl<I2C> Freeze for Vibro<I2C>where
I2C: Freeze,
impl<I2C> RefUnwindSafe for Vibro<I2C>where
I2C: RefUnwindSafe,
impl<I2C> Send for Vibro<I2C>where
I2C: Send,
impl<I2C> Sync for Vibro<I2C>where
I2C: Sync,
impl<I2C> Unpin for Vibro<I2C>where
I2C: Unpin,
impl<I2C> UnwindSafe for Vibro<I2C>where
I2C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more