Struct capsules::gpio_async::GPIOAsync
[−]
[src]
pub struct GPIOAsync<'a, Port: Port + 'a> { ports: &'a [&'a Port], callback: Cell<Option<Callback>>, interrupt_callback: Cell<Option<Callback>>, }
Fields
ports: &'a [&'a Port]
callback: Cell<Option<Callback>>
interrupt_callback: Cell<Option<Callback>>
Methods
impl<'a, Port: Port> GPIOAsync<'a, Port>
[src]
pub fn new(ports: &'a [&'a Port]) -> GPIOAsync<'a, Port>
[src]
fn configure_input_pin(
&self,
port: usize,
pin: usize,
config: usize
) -> ReturnCode
[src]
&self,
port: usize,
pin: usize,
config: usize
) -> ReturnCode
fn configure_interrupt(
&self,
port: usize,
pin: usize,
config: usize
) -> ReturnCode
[src]
&self,
port: usize,
pin: usize,
config: usize
) -> ReturnCode
Trait Implementations
impl<'a, Port: Port> Client for GPIOAsync<'a, Port>
[src]
fn fired(&self, pin: usize, identifier: usize)
[src]
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. Read more
fn done(&self, value: usize)
[src]
Done is called when a configuration command finishes.
impl<'a, Port: Port> Driver for GPIOAsync<'a, Port>
[src]
fn subscribe(&self, subscribe_num: usize, callback: Callback) -> ReturnCode
[src]
Setup callbacks for gpio_async events.
subscribe_num
0
: Setup a callback for when split-phase operations complete. This callback gets called from the gpio_asyncdone()
event and signals the end of operations like asserting a GPIO pin or configuring an interrupt pin. The callback will be called with two valid arguments. The first is the callback type, which is currently 0 for alldone()
events. The second is a value, which is only useful for operations which should return something, like a GPIO read.1
: Setup a callback for when a GPIO interrupt occurs. This callback will be called with two arguments, the first being the port number of the interrupting pin, and the second being the pin number.
fn command(
&self,
command_num: usize,
pin: usize,
data: usize,
_: AppId
) -> ReturnCode
[src]
&self,
command_num: usize,
pin: usize,
data: usize,
_: AppId
) -> ReturnCode
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 check and get number of GPIO ports supported.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.
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