Struct capsules_extra::gpio_async::GPIOAsync

source ·
pub struct GPIOAsync<'a, Port: Port> { /* private fields */ }

Implementations§

source§

impl<'a, Port: Port> GPIOAsync<'a, Port>

source

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> Client for GPIOAsync<'_, Port>

source§

fn fired(&self, pin: usize, identifier: usize)

Called when an interrupt occurs. The pin that interrupted is included, and the identifier that was passed with the call to enable_interrupt is also returned.
source§

fn done(&self, value: usize)

Done is called when a configuration command finishes.
source§

impl<Port: Port> SyscallDriver for GPIOAsync<'_, Port>

source§

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>

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)>

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 more

Auto 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.