General Purpose Inputs¶
The following commands are available to read and control GPIs. Some read commands use the SET_GPI_READ_HEADER command to select the GPI port and pin.
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_PORT |
uint32 |
1 |
Read current logic level of all pins in the selected GPI port. |
GET_GPI_PIN |
uint32 |
1 |
Read current logic level of the selected GPI pin. |
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 logic 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 GPI 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 keyword interrupt on |
GET_KWD_INTERRUPT_PIN |
uint8 |
1 |
Read GPI pin index to receive keyword interrupt on |