Struct kernel::gpio::Registration
source · [−]pub struct Registration<T: Chip> { /* private fields */ }
Expand description
A registration of a gpio chip.
Examples
The following example registers an empty gpio chip.
use kernel::{
device::RawDevice,
gpio::{self, Registration},
};
struct MyGpioChip;
#[vtable]
impl gpio::Chip for MyGpioChip {
type Data = ();
}
fn example(parent: &dyn RawDevice) -> Result<Pin<Box<Registration<MyGpioChip>>>> {
let mut r = Pin::from(Box::try_new(Registration::new())?);
kernel::gpio_chip_register!(r.as_mut(), 32, None, parent, ())?;
Ok(r)
}
Implementations
sourceimpl<T: Chip> Registration<T>
impl<T: Chip> Registration<T>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Registration
but does not register it yet.
It is allowed to move.
sourcepub fn register(
self: Pin<&mut Self>,
gpio_count: u16,
base: Option<i32>,
parent: &dyn RawDevice,
data: T::Data,
lock_keys: [&'static LockClassKey; 2]
) -> Result
pub fn register(
self: Pin<&mut Self>,
gpio_count: u16,
base: Option<i32>,
parent: &dyn RawDevice,
data: T::Data,
lock_keys: [&'static LockClassKey; 2]
) -> Result
Registers a gpio chip with the rest of the kernel.
Users are encouraged to use the gpio_chip_register
macro because it automatically
defines the lock classes and calls the registration function.
Trait Implementations
sourceimpl<T: Chip> Default for Registration<T>
impl<T: Chip> Default for Registration<T>
sourceimpl<T: Chip> Drop for Registration<T>
impl<T: Chip> Drop for Registration<T>
impl<T: Chip> Send for Registration<T>
impl<T: Chip> Sync for Registration<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for Registration<T>
impl<T> !Unpin for Registration<T>
impl<T> UnwindSafe for Registration<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more