components::gpio

Type Alias GpioComponentType

Source
pub type GpioComponentType<IP> = GPIO<'static, IP>;

Aliased Type§

struct GpioComponentType<IP> { /* private fields */ }

Implementations

Source§

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

Source

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

Trait Implementations

Source§

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

Source§

fn fired(&self, pin_num: u32)

Source§

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

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