Trait GPIOExtras

Source
pub trait GPIOExtras<T> {
    // Required methods
    fn write_pin_range(&self, offset: usize, count: usize, data: u16);
    fn read_pin_range(&self, offset: usize, count: usize) -> u16;
    fn pin_config(&self, pin: usize) -> &T;

    // Provided methods
    fn write_pin(&self, offset: usize, bit: bool) { ... }
    fn read_pin(&self, offset: usize) -> bool { ... }
}
Expand description

Convenient access to the bit blocks on GPIO ports.

Required Methods§

Source

fn write_pin_range(&self, offset: usize, count: usize, data: u16)

Set count bits on the GPIO port starting from the bit number offset. Other bits are not affected. Uses BSRR register to set/clear individual bits. Bits must fit into 16 bits of the GPIO port.

Source

fn read_pin_range(&self, offset: usize, count: usize) -> u16

Get count bits on the GPIO port starting from the bit number offset.

Source

fn pin_config(&self, pin: usize) -> &T

Get access to configuration bits for pin of GPIO port.

Provided Methods§

Source

fn write_pin(&self, offset: usize, bit: bool)

Set single bit at the given offset in GPIO port. offset must be in the range 0..16.

Source

fn read_pin(&self, offset: usize) -> bool

Get single bit at the given offset in GPIO port. offset must be in the range 0..16.

Implementors§