Struct Trellis

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

The Trellis device abstraction.

Implementations§

Source§

impl Trellis

Source

pub fn new(dev: Box<dyn I2CMasterDevice>) -> Trellis

Construct a new Trellis device with a particular I2C-Device. See the devices module for a list of concrete devices that can be used. Note: object has to be initialised with a call to init before you can control the LEDs and buttons.

Source

pub fn init(&mut self)

Initialise the trellis connection. Has to be called exactly once for a trellis.

Source

pub fn set_led(&mut self, col: Col, row: Row)

Turn a LED on the specified position to on.

Source

pub fn clear_led(&mut self, col: Col, row: Row)

Turn a LED on the specified position to off.

Source

pub fn is_led_set(&mut self, col: Col, row: Row) -> bool

Returns the LED state (on or off) from the internal display buffer. The state may not reflect the actual state on the hardware if the display buffer was not written.

Source

pub fn write_display(&mut self)

Writes the internal display buffer to the hardware. You must call this function manually after updating the LED states of the trellis.

Source

pub fn button_evt_loop(&mut self, hnd: EventLoopHandler)

Start the button read event loop. This function does not terminate and can only be stopped by the supplied event handler returning false. The polling interval for reading the button is currently fixed to 30ms.

Auto Trait Implementations§

§

impl Freeze for Trellis

§

impl !RefUnwindSafe for Trellis

§

impl !Send for Trellis

§

impl !Sync for Trellis

§

impl Unpin for Trellis

§

impl !UnwindSafe for Trellis

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.