Struct capsules_extra::gpio_async::GPIOAsync
source · pub struct GPIOAsync<'a, Port: Port> { /* private fields */ }
Implementations§
source§impl<'a, Port: Port> GPIOAsync<'a, Port>
impl<'a, Port: Port> GPIOAsync<'a, Port>
pub fn new( ports: &'a [&'a Port], grants: Grant<App, UpcallCount<2>, AllowRoCount<0>, AllowRwCount<0>>, ) -> GPIOAsync<'a, Port>
Trait Implementations§
source§impl<Port: Port> SyscallDriver for GPIOAsync<'_, Port>
impl<Port: Port> SyscallDriver for GPIOAsync<'_, Port>
source§fn command(
&self,
command_number: usize,
pin: usize,
data: usize,
process_id: ProcessId,
) -> CommandReturn
fn command( &self, command_number: usize, pin: usize, data: usize, process_id: ProcessId, ) -> CommandReturn
Configure and read GPIO pins.
pin
is the index of the pin.
data
is a 32 bit value packed with the lowest 16 bits as the port
number, and the remaining upper bits as a command-specific value.
§command_num
0
: Driver existence check.1
: Set a pin as an output.2
: Set a pin high by setting it to 1.3
: Clear a pin by setting it to 0.4
: Toggle a pin.5
: Set a pin as an input and configure its pull-up or pull-down state. The command-specific field should be set to 0 for a pull-up, 1 for a pull-down, or 2 for neither.6
: Read a GPIO pin state, and have its value returned in the done() callback.7
: Enable an interrupt on a GPIO pin. The command-specific data should be 0 for an either-edge interrupt, 1 for a rising edge interrupt, and 2 for a falling edge interrupt.8
: Disable an interrupt on a pin.9
: Disable a GPIO pin.10
: Get number of GPIO ports supported.
source§fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
Request to allocate a capsule’s grant for a specific process. Read more
source§fn allow_userspace_readable(
&self,
app: ProcessId,
which: usize,
slice: ReadWriteProcessBuffer,
) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer, ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
System call for a process to pass a buffer (a
UserspaceReadableProcessBuffer
) to the kernel that the kernel can
either read or write. The kernel calls this method only after it checks
that the entire buffer is within memory the process can both read and
write. Read moreAuto Trait Implementations§
impl<'a, Port> !Freeze for GPIOAsync<'a, Port>
impl<'a, Port> !RefUnwindSafe for GPIOAsync<'a, Port>
impl<'a, Port> !Send for GPIOAsync<'a, Port>
impl<'a, Port> !Sync for GPIOAsync<'a, Port>
impl<'a, Port> Unpin for GPIOAsync<'a, Port>
impl<'a, Port> !UnwindSafe for GPIOAsync<'a, Port>
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