[−][src]Struct bcm283x_linux_gpio::Gpio
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
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,