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§
Sourcefn write_pin_range(&self, offset: usize, count: usize, data: u16)
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.
Sourcefn read_pin_range(&self, offset: usize, count: usize) -> u16
fn read_pin_range(&self, offset: usize, count: usize) -> u16
Get count
bits on the GPIO port starting from the bit number offset
.
Sourcefn pin_config(&self, pin: usize) -> &T
fn pin_config(&self, pin: usize) -> &T
Get access to configuration bits for pin
of GPIO port.