Unit PCF857X

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


NXP PCF857X I/O Expander Driver unit

The NXP PCF8574 is an 8 bit I/O expander that provides GPIO pin control functions over an I2C connection.

The device can be represented in Ultibo as a standard GPIO device which is accessible via the GPIO unit functions. Because the PCF857X is a chip that can be used and configured in multiple different scenarios this unit does not autocreate a GPIO device, instead you need to call the function PCF8574GPIOCreate and pass an I2C device and address. The function will create and return a GPIO device with the appropriate number of pins and other information for the specified chip, the returned devices will have been registered with the GPIO device unit and started ready for use.

Note: This unit does not currently implement the interrupt capabilities of the PCF857X chips however it could be expanded to allow the interrupt pin to be connected to a GPIO pin on the SoC and use a trigger event from that to enable GPIOInputWait/GPIOInputEvent functions for the PCF857X chips.

Constants



[Expand]
PCF857X specific constants PCF8574_GPIO_*


[Expand]
PCF857X chip PCF857X_CHIP_*


[Expand]
PCF857X I2C PCF8574_I2C_*


Type definitions



PCF857X GPIO

[Expand]

PPCF857XGPIO = ^TPCF857XGPIO;

TPCF857XGPIO = record


Public variables


None defined

Function declarations



PCF857X functions

[Expand]
function PCF8574GPIOCreate(I2C:PI2CDevice; Address:Word):PGPIODevice;
Description: Create, register and start a new PCF8574 GPIO device connected to the specified I2C device


[Expand]
function PCF857XGPIODestroy(GPIO:PGPIODevice):LongWord;
Description: Stop, deregister and destroy a PCF857X GPIO device created by this driver


PCF857X GPIO functions

[Expand]
function PCF857XGPIOStart(GPIO:PGPIODevice):LongWord;
Description: Implementation of GPIODeviceStart API for PCF857X


[Expand]
function PCF857XGPIOStop(GPIO:PGPIODevice):LongWord;
Description: Implementation of GPIODeviceStop API for PCF857X


[Expand]
function PCF857XGPIORead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
Description: Implementation of GPIODeviceRead API for PCF857X


[Expand]
procedure PCF857XGPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
Description: Implementation of GPIODeviceWrite API for PCF857X


[Expand]
function PCF857XGPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Implementation of GPIODeviceInputGet API for PCF857X


[Expand]
function PCF857XGPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Description: Implementation of GPIODeviceOutputSet API for PCF857X


[Expand]
function PCF857XGPIOPullGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Implementation of GPIODevicePullGet API for PCF857X


[Expand]
function PCF857XGPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Implementation of GPIODeviceFunctionGet API for PCF857X


[Expand]
function PCF857XGPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: Implementation of GPIODeviceFunctionSelect API for PCF857X


Return to Unit Reference