capsules_extra::gpio_async

Struct 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>,

Source§

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

Source§

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.