Struct rustpi_io::gpio::GPIO
[−]
[src]
pub struct GPIO { /* fields omitted */ }
A software representation for a GPIO pin of the raspberry pi.
Methods
impl GPIO
[src]
fn gpio_number(&self) -> u8
[src]
Returns the configured pin of the GPIO struct.
fn current_mode(&self) -> GPIOMode
[src]
Returns the configured mode of the GPIO struct.
fn set_mode(&mut self, mode: GPIOMode) -> Result<&mut Self>
[src]
Changes the mode of the pin and writes the corresponding value to the fitting direction file
fn new(gpio: u8, mode: GPIOMode) -> Result<Self>
[src]
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)
fn value(&self) -> Result<GPIOData>
[src]
Reads the current value of the pin in both Read and Write mode. Returns an Error if a value other than "1" or "0" is read
fn set(&self, data: GPIOData) -> Result<()>
[src]
Sets the value of the gpio to HIGH or LOW Returns an Error if the GPIO::Mode is not Write
Trait Implementations
impl Drop for GPIO
[src]
Closes the gpio and write its pin number into /sys/class/gpio/unexport