Struct capsules_core::gpio::GPIO

source ·
pub struct GPIO<'a, IP: InterruptPin<'a>> { /* private fields */ }

Implementations§

source§

impl<'a, IP: InterruptPin<'a>> GPIO<'a, IP>

source

pub fn new( pins: &'a [Option<&'a InterruptValueWrapper<'a, IP>>], grant: Grant<(), UpcallCount<1>, AllowRoCount<0>, AllowRwCount<0>> ) -> Self

Trait Implementations§

source§

impl<'a, IP: InterruptPin<'a>> ClientWithValue for GPIO<'a, IP>

source§

fn fired(&self, pin_num: u32)

source§

impl<'a, IP: InterruptPin<'a>> SyscallDriver for GPIO<'a, IP>

source§

fn command( &self, command_num: usize, data1: usize, data2: usize, _: ProcessId ) -> CommandReturn

Query and control pin values and states.

Each byte of the data argument is treated as its own field. For all commands, the lowest order halfword is the pin number (pin). A few commands use higher order bytes for purposes documented below. If the higher order bytes are not used, they must be set to 0.

Other data bytes:

  • pin_config: An internal resistor setting. Set to 0 for a pull-up resistor. Set to 1 for a pull-down resistor. Set to 2 for none.
  • irq_config: Interrupt configuration setting. Set to 0 to interrupt on either edge. Set to 1 for rising edge. Set to 2 for falling edge.
§command_num
  • 0: Driver existence check.
  • 1: Enable output on pin.
  • 2: Set pin.
  • 3: Clear pin.
  • 4: Toggle pin.
  • 5: Enable input on pin with pin_config in 0x00XX00000
  • 6: Read pin value.
  • 7: Configure interrupt on pin with irq_config in 0x00XX00000
  • 8: Disable interrupt on pin.
  • 9: Disable 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, IP> Freeze for GPIO<'a, IP>

§

impl<'a, IP> !RefUnwindSafe for GPIO<'a, IP>

§

impl<'a, IP> !Send for GPIO<'a, IP>

§

impl<'a, IP> !Sync for GPIO<'a, IP>

§

impl<'a, IP> Unpin for GPIO<'a, IP>

§

impl<'a, IP> !UnwindSafe for GPIO<'a, IP>

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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
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.