[][src]Struct bcm283x_linux_gpio::Gpio

pub struct Gpio { /* fields omitted */ }

Methods

impl Gpio[src]

pub fn new() -> Result<Self, Error>[src]

Create a new handle to the GPIO peripheral.

This will attempt to map a portion of /dev/mem, in order to access the memory mapped GPIO peripheral.

This may fail if:

  • we don't have root permission.
  • the kernel was compiled with CONFIG_IO_STRICT_DEVMEM.
  • the kernel was compiled with CONFIG_STRICT_DEVMEM, and not started with iomem=relaxed on the kernel command line.

pub fn control_block(&self) -> *mut c_void[src]

Get the pointer to the mapped control block.

pub fn read_all(&self) -> GpioState[src]

Read the entire current GPIO state.

pub fn read_register(&self, reg: Register) -> u32[src]

Read a value from a register.

pub unsafe fn write_register(&mut self, reg: Register, value: u32)[src]

Write a value to a register.

pub unsafe fn and_register(&mut self, reg: Register, value: u32)[src]

Perform an atomaic bitwise AND on the contents of a register.

pub unsafe fn or_register(&mut self, reg: Register, value: u32)[src]

Perform an atomic bitwise OR on the contents of a register.

pub unsafe fn xor_register(&mut self, reg: Register, value: u32)[src]

Perform an atomic bitwise XOR on the contents of a register.

pub fn read_level(&self, index: usize) -> bool[src]

Read the current level of a GPIO pin.

pub fn set_level(&mut self, index: usize, value: bool)[src]

Atomically set the level of a single GPIO pin.

Trait Implementations

impl Drop for Gpio[src]

Auto Trait Implementations

impl !Send for Gpio

impl !Sync for Gpio

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]