pub struct GPIO { /* private fields */ }
Expand description
A software representation for a GPIO pin of the raspberry pi.
Implementations§
Source§impl GPIO
impl GPIO
Sourcepub fn gpio_number(&self) -> u8
pub fn gpio_number(&self) -> u8
Returns the configured pin of the GPIO struct.
Sourcepub fn current_mode(&self) -> GPIOMode
pub fn current_mode(&self) -> GPIOMode
Returns the configured mode of the GPIO struct.
Sourcepub fn set_mode(&mut self, mode: GPIOMode) -> Result<&mut Self>
pub fn set_mode(&mut self, mode: GPIOMode) -> Result<&mut Self>
Changes the mode of the pin and writes the corresponding value to the fitting direction file
Sourcepub fn new(gpio: u8, mode: GPIOMode) -> Result<Self>
pub fn new(gpio: u8, mode: GPIOMode) -> Result<Self>
Initializes the gpio. Exports the pin with the /sys/class/gpio/export file and calls the set_mode() function with the given mode. Returns an Error if the gpio was already exported earlier (inside or outside of the application)
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