API Reference
Used by apps to control general-purpose digital input/output pins.
A GPIO pin typically has one or more of the following features:
- Can be configured as an input pin or an output pin.
- Can have an internal pull-up resistor or pull-down resistor enabled, or neither.
- If an output, can be push-pull or open-drain.
- If an input, can trigger an "interrupt" (asynchronous notification of state change).
Output pins can be driven in three different modes:
- Push-pull: A transistor connects to the supply and another transistor connects to ground (only one is operated at a time)
- Tri-state: Same as push-pull, with an added high-impedance (high Z) state, in which the pin is essentially disconnected from both ground and supply.
- Open drain: A transistor connects to ground and nothing else. Can only be used to pull low.
In addition, pins have a "polarity".
- An active-high polarity pin is read/written as a digital 1 (true) when its voltage is "high" and 0 (false) when its voltage is "low" (grounded).
- An active-low pin is read/written as a digital 1 (true) when its voltage is "low" (grounded) and 0 (false) when its voltage is "high".
The following functions are used to configure the GPIO pin:
- SetInput() - Configure as an input pin.
- SetPushPullOutput() - Configure as push-pull output pin (can drive high or low).
- SetTriStateOutput() - Configure as tri-state output pin (can drive high or low or neither).
- SetOpenDrainOutput() - Configure as open-drain output pin (only pulls low).
- EnablePullUp() - Enables the internal pull-up resistor (and disables the pull-down).
- EnablePullDown() - Enables the internal pull-down resistor (and disables the pull-up).
- DisableResistors() - Disables the internal pull-up/down resistors.
To set the level of an output pin, call Activate(), Deactivate(), or SetHighZ().
To poll the value of an input pin, call Read().
Use SetChangeCallback() to register a notification callback function to be called when the state of an input pin changes.
Each GPIO pin is accessed through a single IPC service. This makes it possible to use bindings to control which GPIO pins each app is allowed to access. It also simplifies the API by removing the need to specify which pin is desired and allows the pins to be named differently in the client and the server, so the client can be more portable.
Binding example:
bindings:
{
ui.frontPanel.powerLed -> cf3.pin22
}
Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.