General Purpose Inputs¶
The following commands are available to read and control GPIs. Note that interrupt registers are set to 1 when an edge has been detected and 0 when no event has occurred. All interrupt registers are initialised to 0 on boot.
The following parameters are available to interrogate and configure the GPI behaviour.
COMMAND |
TYPE |
ARGS |
DESCRIPTION |
---|---|---|---|
GET_GPI |
uint32 |
1 |
Read current level of all pins of the selected GPIO port. Pin 0 corresponds to the LSB of the port. |
GET_GPI_INT_PENDING_PIN |
uint32 |
1 |
Read whether interrupt was triggered for selected pin. The interrupt pending register for the selected pin is cleared by this command. |
GET_GPI_INT_PENDING_PORT |
uint32 |
1 |
Read whether interrupt was triggered for all pins on selected port. The interrupt pending register for the whole port is cleared by this command. |
SET_GPI_PIN_ACTIVE_LEVEL |
uint8 |
3 |
Set the active level for a specific GPI pin. Arguments are <Port Index> <Pin Index> <0: active low, 1: active high>. By default, all GPI pins are set to active high. |
SET_GPI_INT_CONFIG |
uint8 |
3 |
Sets the interrupt config for a specific pin. Arguments are <Port Index> <Pin Index> <Interrupt type 0=None, 1=Falling, 2=Rising, 3=Both>. |
SET_GPI_READ_HEADER |
uint8 |
2 |
Sets the selected port and pin for the next GPIO read.
Arguments are <Port Index> <Pin Index>.
|
GET_GPI_READ_HEADER |
uint8 |
2 |
Gets the currently selected port and pin set by a previous SET_GPI_READ_HEADER command. |
SET_KWD_INTERRUPT_PIN |
uint8 |
1 |
Set gpi pin index to receive kwd interrupt on |
GET_KWD_INTERRUPT_PIN |
uint8 |
1 |
Read gpi pin index to receive kwd interrupt on |