USBDevice

Struct USBDevice 

Source
pub struct USBDevice { /* private fields */ }
Expand description

Implementation of the luxafor USB device.

Implementations§

Source§

impl USBDevice

Source

pub fn id(&self) -> String

Returns the USB device identifier.

Source

pub fn read(&self, buffer: &mut [u8]) -> Result<usize, HidError>

Blocking read on the device and returns the length of the payload.

Source

pub fn read_timeout( &self, buffer: &mut [u8], timeout: i32, ) -> Result<usize, HidError>

Same as read but blocking is termianted after the timeout.

Source

pub fn is_button_pressed( &self, timeout: i32, interval: u64, ) -> Result<bool, HidError>

Checks whether the mute button is pressed for a period of time.

Source

pub fn is_button_pressed_feedback( &self, timeout: i32, interval: u64, color: Color, ) -> Result<bool, HidError>

TODO: Implement feeback using other light modes. Checks whether the mute button is pressed for a period of time and set strobing light as feedback after the timeout.

Source

pub fn set_static_color(&self, color: Color) -> Result<(), HidError>

Sets a static luxafor light.

Source

pub fn set_circling_color( &self, color: Color, pattern: CircularLength, circling_rate: u8, iterations: u8, ) -> Result<(), HidError>

Sets the the luxafor light to a circling color mode.

Source

pub fn set_strobe_color( &self, color: Color, strobe_speed: u8, iterations: u8, ) -> Result<(), HidError>

Sets the luxafor light to a strobing pattern.

Auto Trait Implementations§

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.