Struct capsules::gpio::GPIO
[−]
[src]
pub struct GPIO<'a, G: Pin + 'a> { pins: &'a [&'a G], callback: Cell<Option<Callback>>, }
Fields
pins: &'a [&'a G]
callback: Cell<Option<Callback>>
Methods
impl<'a, G: Pin + PinCtl> GPIO<'a, G>
[src]
pub fn new(pins: &'a [&'a G]) -> GPIO<'a, G>
[src]
fn configure_input_pin(&self, pin_num: usize, config: usize) -> ReturnCode
[src]
fn configure_interrupt(&self, pin_num: usize, config: usize) -> ReturnCode
[src]
Trait Implementations
impl<'a, G: Pin> Client for GPIO<'a, G>
[src]
fn fired(&self, pin_num: usize)
[src]
Called when an interrupt occurs. The identifier
will be the same value that was passed to enable_interrupt()
when the interrupt was configured. Read more
impl<'a, G: Pin + PinCtl> Driver for GPIO<'a, G>
[src]
fn subscribe(&self, subscribe_num: usize, callback: Callback) -> ReturnCode
[src]
Subscribe to GPIO pin events.
subscribe_num
0
: Subscribe to interrupts from all pins with interrupts enabled. The callback signature isfn(pin_num: usize, pin_state: bool)
fn command(
&self,
command_num: usize,
data1: usize,
data2: usize,
_: AppId
) -> ReturnCode
[src]
&self,
command_num: usize,
data1: usize,
data2: usize,
_: AppId
) -> ReturnCode
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 to0
for a pull-up resistor. Set to1
for a pull-down resistor. Set to2
for none.irq_config
: Interrupt configuration setting. Set to0
to interrupt on either edge. Set to1
for rising edge. Set to2
for falling edge.
command_num
0
: Number of pins.1
: Enable output onpin
.2
: Setpin
.3
: Clearpin
.4
: Togglepin
.5
: Enable input onpin
withpin_config
in 0x00XX000006
: Readpin
value.7
: Configure interrupt onpin
withirq_config
in 0x00XX000008
: Disable interrupt onpin
.9
: Disablepin
.
fn allow(
&self,
app: AppId,
minor_num: usize,
slice: AppSlice<Shared, u8>
) -> ReturnCode
[src]
&self,
app: AppId,
minor_num: usize,
slice: AppSlice<Shared, u8>
) -> ReturnCode
allow
lets an application give the driver access to a buffer in the application's memory. This returns ENOSUPPORT
if not used. Read more