pub struct Gpio { /* private fields */ }Expand description
Manages a gpio pin to write on (in order set it high or low) and read its value.
Implementations§
Source§impl Gpio
impl Gpio
Sourcepub fn new(pin: u32) -> Result<Self, Error>
pub fn new(pin: u32) -> Result<Self, Error>
Creates a new Gpio object on a pin from its number and initialises
its files.
Because Raspberry PI devices can’t have more than 40 pins, the given
pin must follow this condition: pin <= 40.
Sourcepub fn write(&self, value: bool) -> Result<(), Error>
pub fn write(&self, value: bool) -> Result<(), Error>
Writes the value to the GPIO value file and then activate or deactivate the port.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Gpio
impl RefUnwindSafe for Gpio
impl Send for Gpio
impl Sync for Gpio
impl Unpin for Gpio
impl UnwindSafe for Gpio
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more