AudioScience HPI Version_4.24.1
Functions

GPIO

The GPIO object on an adapter reperesents a number of input bits that may be individually sensed and a number of digital output bits that may be individually set. More...

Functions

hpi_err_t HPI_GpioOpen (const hpi_hsubsys_t *phSubSys, uint16_t wAdapterIndex, hpi_handle_t *phGpio, uint16_t *pwNumberInputBits, uint16_t *pwNumberOutputBits)
 Opens the GPIO on a particular adapter for reading and writing.
hpi_err_t HPI_GpioReadBit (const hpi_hsubsys_t *phSubSys, hpi_handle_t hGpio, uint16_t wBitIndex, uint16_t *pwBitData)
 Read a particular bit from an adapter's GPIO input port.
hpi_err_t HPI_GpioReadAllBits (const hpi_hsubsys_t *phSubSys, hpi_handle_t hGpio, uint16_t awAllBitData[4])
 Read all bits from an adapter's GPIO input ports.
hpi_err_t HPI_GpioWriteBit (const hpi_hsubsys_t *phSubSys, hpi_handle_t hGpio, uint16_t wBitIndex, uint16_t wBitData)
 Write a particular bit to an adapter's GPIO output port.
hpi_err_t HPI_GpioWriteStatus (const hpi_hsubsys_t *phSubSys, hpi_handle_t hGpio, uint16_t awAllBitData[4])
 Read back the current status of all GPIO outputs on an adapter.

Detailed Description

The GPIO object on an adapter reperesents a number of input bits that may be individually sensed and a number of digital output bits that may be individually set.

There is at most one GPIO object per adapter.

On an adapter such as an ASI4346, the bit outputs control relay closurers. HPI_GpioWriteBit() can be used to set the state of each of the relays. Similarly, the inputs on the ASI4346 are mapped 1 to 1 to opto isolated inputs.


Function Documentation

hpi_err_t HPI_GpioOpen ( const hpi_hsubsys_t *  phSubSys,
uint16_t  wAdapterIndex,
hpi_handle_t phGpio,
uint16_t *  pwNumberInputBits,
uint16_t *  pwNumberOutputBits 
)

Opens the GPIO on a particular adapter for reading and writing.

It returns a handle to the GPIO object (hGpio) and the number of input and output bits (*pwNumberInputBits,*pwNumberOutputBits). If the adapter does not have any GPIO functionality, the function will return an error.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
wAdapterIndexGet GPIO handle for this adapter.
phGpioReturned handle to GPIO object.
pwNumberInputBitsReturned number of GPIO inputs.
pwNumberOutputBitsReturned number of GPIO outputs.

References HPI_IndexesToHandle().

hpi_err_t HPI_GpioReadBit ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hGpio,
uint16_t  wBitIndex,
uint16_t *  pwBitData 
)

Read a particular bit from an adapter's GPIO input port.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hGpioHandle to GPIO object.
wBitIndexBit index to read.
pwBitDataReturned state of the input. A "1" means the input has been set.
hpi_err_t HPI_GpioReadAllBits ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hGpio,
uint16_t  awAllBitData[4] 
)

Read all bits from an adapter's GPIO input ports.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hGpioHandle to GPIO object.
awAllBitDataReturned input states. pwBitData should point to an array of uint16_t bits[4]. Bit 0 refers to the 1st GPIO input.
hpi_err_t HPI_GpioWriteBit ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hGpio,
uint16_t  wBitIndex,
uint16_t  wBitData 
)

Write a particular bit to an adapter's GPIO output port.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hGpioHandle to GPIO object.
wBitIndexAn index which addresses one of the input bits.
wBitDataThe state to set the output to. A "1" turns the output on.
hpi_err_t HPI_GpioWriteStatus ( const hpi_hsubsys_t *  phSubSys,
hpi_handle_t  hGpio,
uint16_t  awAllBitData[4] 
)

Read back the current status of all GPIO outputs on an adapter.

Returns:
0 on success, or one of the HPI_ERROR_CODES.
Parameters:
phSubSysVestigial subsys handle (unused), may be set to NULL
hGpioHandle to GPIO object.
awAllBitDataReturned output states. pwBitData should point to an array of uint16_t bits[4]. Bit 0 refers to the 1st GPIO output.