qwiic_button_led

Struct ButtonLED

Source
pub struct ButtonLED<I2C> { /* private fields */ }
Expand description

This struct contains all the functions to interface with the Qwiic button LED.

Implementations§

Source§

impl<I2C> ButtonLED<I2C>
where I2C: Write + WriteRead,

Source

pub fn init(i2c: I2C, address: u8) -> Self

Initialize a ButtonLED struct

Source

pub fn button_id(&mut self) -> Result<u8, Error>

The button ID is read-only and always returns 0x5D.

Source

pub fn firmware_version(&mut self) -> Result<u16, Error>

The firmware version for this button LED.

Source

pub fn button_status(&mut self) -> Result<ButtonStatus, Error>

Determine the status of this button.

Source

pub fn set_button_status( &mut self, new_status: ButtonStatus, ) -> Result<(), Error>

Set the button status, e.g. to clear events

Source

pub fn interrupt_config(&mut self) -> Result<InterruptConfig, Error>

Query the interrupt configuration.

Source

pub fn set_interrupt_config( &mut self, config: InterruptConfig, ) -> Result<(), Error>

Manipulate the interrupt configuration.

Source

pub fn button_debounce_time(&mut self) -> Result<u16, Error>

Query the debounce time, a measurement of how long after the button is released that it requires to reset to the default state.

Source

pub fn set_button_debounce_time(&mut self, time: u16) -> Result<(), Error>

Manipulate the debounce time.

Source

pub fn pressed_queue_full(&mut self) -> Result<bool, Error>

Is the button pressed queue full.

Source

pub fn pressed_queue_empty(&mut self) -> Result<bool, Error>

Is the button pressed queue empty.

Source

pub fn pressed_queue_status(&mut self) -> Result<PressedQueueStatus, Error>

Query the button pressed queue: empty / full.

Source

pub fn newest_press_timestamp(&mut self) -> Result<u32, Error>

The timestamp in milliseconds since the most recent button press in the queue.

Source

pub fn oldest_press_timestamp(&mut self) -> Result<u32, Error>

The timestamp in milliseconds since the first button press in the queue.

Source

pub fn clicked_queue_full(&mut self) -> Result<bool, Error>

Is the button clicked queue full.

Source

pub fn clicked_queue_empty(&mut self) -> Result<bool, Error>

Is the button clicked queue empty.

Source

pub fn clicked_queue_status(&mut self) -> Result<ClickedQueueStatus, Error>

Query the button pressed queue: empty / full.

Source

pub fn newest_click_timestamp(&mut self) -> Result<u32, Error>

The timestamp in milliseconds since the most recent button click in the queue.

Source

pub fn oldest_click_timestamp(&mut self) -> Result<u32, Error>

The timestamp in milliseconds since the first button click in the queue.

Source

pub fn led_brightness(&mut self) -> Result<u8, Error>

The LED brightness.

Source

pub fn set_led_brightness(&mut self, brightness: u8) -> Result<(), Error>

Set LED brightness.

Source

pub fn led_pulse_granularity(&mut self) -> Result<u8, Error>

The number of steps the LED uses from one brightness setting another when updated.

Source

pub fn set_led_pulse_granularity(&mut self, brightness: u8) -> Result<(), Error>

Set the LED update granularity.

Source

pub fn led_pulse_cycle_time(&mut self) -> Result<u16, Error>

When set, the LED pulses on for this value in milliseconds.

Source

pub fn set_led_pulse_cycle_time(&mut self, cycle_time: u16) -> Result<(), Error>

Set the LED pulse on time in milliseconds (0 disables).

Source

pub fn led_pulse_off_time(&mut self) -> Result<u16, Error>

The duration in milliseconds the LED is off while pulsing.

Source

pub fn set_led_pulse_off_time(&mut self, off_time: u16) -> Result<(), Error>

Set the LED off time in milliseconds (0 disables).

Source

pub fn device_address(&mut self) -> Result<u8, Error>

The address of this button LED.

Source

pub fn set_device_address(&mut self, new_address: u8) -> Result<(), Error>

Set the address of this button LED (0x08 - 0x77).

Trait Implementations§

Source§

impl<I2C: Debug> Debug for ButtonLED<I2C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<I2C> UnwindSafe for ButtonLED<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.