Skip to main content

Led

Trait Led 

Source
pub trait Led {
    // Required methods
    fn init(&self);
    fn on(&self);
    fn off(&self);
    fn toggle(&self);
    fn read(&self) -> bool;
}
Expand description

Simple on/off interface for LED pins.

Since GPIO pins are synchronous in Tock the LED interface is synchronous as well.

Required Methods§

Source

fn init(&self)

Initialize the LED. Must be called before the LED is used.

Source

fn on(&self)

Turn the LED on.

Source

fn off(&self)

Turn the LED off.

Source

fn toggle(&self)

Toggle the LED.

Source

fn read(&self) -> bool

Return the on/off state of the LED. true if the LED is on, false if it is off.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<P: Pin> Led for LedHigh<'_, P>

Source§

impl<P: Pin> Led for LedLow<'_, P>