Unit PCF857X

From Ultibo.org
Revision as of 05:17, 19 June 2021 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


NXP PCF857X I/O expander Driver

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



PCF857X specific constants PCF8574_GPIO_*
PCF8574_GPIO_DESCRIPTION = 'NXP PCF8574 8-bit I/O Expander'; Description of PCF8574 device
 
PCF8574_GPIO_MIN_PIN = GPIO_PIN_0;  
PCF8574_GPIO_MAX_PIN = GPIO_PIN_7;  
PCF8574_GPIO_PIN_COUNT = 8;  
 
PCF857X_GPIO_MAX_LEVEL = GPIO_LEVEL_HIGH;  
 
PCF857X_GPIO_MAX_PULL = GPIO_PULL_UP;  
 
PCF857X_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
PCF857X_GPIO_MAX_FUNCTION = GPIO_FUNCTION_OUT;  


PCF857X chip PCF857X_CHIP_*
PCF857X_CHIP_PCF8574 = 0;  


PCF857X I2C PCF8574_I2C_*
Note: The PCF857X is a single register device and does not have any direction, pull or configuration registers
PCF8574_I2C_RATE = 100000; Default I2C clock rate (Device supports 100KHz only)
 
PCF8574_I2C_SIZE = 1; Number of bytes to read/write all pin values
 
PCF857X_I2C_MAX_SIZE = 2; Maximum number of bytes to read/write all pin values


Type definitions


To be documented

Public variables


None defined

Function declarations


To be documented


Return to Unit Reference