Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
pcf857x.h File Reference
#include "ultibo/gpio.h"
#include "ultibo/i2c.h"

Go to the source code of this file.

Data Structures

struct  _PCF857XGPIO

Macros

#define PCF8574_GPIO_DESCRIPTION   "NXP PCF8574 8-bit I/O Expander"
 Description of PCF8574 device.
#define PCF8574_GPIO_MIN_PIN   GPIO_PIN_0
#define PCF8574_GPIO_MAX_PIN   GPIO_PIN_7
#define PCF8574_GPIO_PIN_COUNT   8
#define PCF857X_GPIO_MAX_LEVEL   GPIO_LEVEL_HIGH
#define PCF857X_GPIO_MAX_PULL   GPIO_PULL_UP
#define PCF857X_GPIO_MIN_FUNCTION   GPIO_FUNCTION_IN
#define PCF857X_GPIO_MAX_FUNCTION   GPIO_FUNCTION_OUT
#define PCF857X_CHIP_PCF8574   0
#define PCF8574_I2C_RATE   100000
 Default I2C clock rate (Device supports 100KHz only).
#define PCF8574_I2C_SIZE   1
 Number of bytes to read/write all pin values.
#define PCF857X_I2C_MAX_SIZE   2
 Maximum number of bytes to read/write all pin values.

Typedefs

typedef struct _PCF857XGPIO PCF857XGPIO

Functions

GPIO_DEVICE *STDCALL pcf8574gpio_create (I2C_DEVICE *i2c, uint16_t address)
 Create, register and start a new PCF8574 GPIO device connected to the specified I2C device.
uint32_t STDCALL pcf857xgpio_destroy (GPIO_DEVICE *gpio)
 Stop, deregister and destroy a PCF857X GPIO device created by this driver.

Macro Definition Documentation

◆ PCF8574_GPIO_DESCRIPTION

#define PCF8574_GPIO_DESCRIPTION   "NXP PCF8574 8-bit I/O Expander"

Description of PCF8574 device.

PCF857X specific constants

◆ PCF8574_GPIO_MIN_PIN

#define PCF8574_GPIO_MIN_PIN   GPIO_PIN_0

◆ PCF8574_GPIO_MAX_PIN

#define PCF8574_GPIO_MAX_PIN   GPIO_PIN_7

◆ PCF8574_GPIO_PIN_COUNT

#define PCF8574_GPIO_PIN_COUNT   8

◆ PCF857X_GPIO_MAX_LEVEL

#define PCF857X_GPIO_MAX_LEVEL   GPIO_LEVEL_HIGH

◆ PCF857X_GPIO_MAX_PULL

#define PCF857X_GPIO_MAX_PULL   GPIO_PULL_UP

◆ PCF857X_GPIO_MIN_FUNCTION

#define PCF857X_GPIO_MIN_FUNCTION   GPIO_FUNCTION_IN

◆ PCF857X_GPIO_MAX_FUNCTION

#define PCF857X_GPIO_MAX_FUNCTION   GPIO_FUNCTION_OUT

◆ PCF857X_CHIP_PCF8574

#define PCF857X_CHIP_PCF8574   0

PCF857X chip constants

◆ PCF8574_I2C_RATE

#define PCF8574_I2C_RATE   100000

Default I2C clock rate (Device supports 100KHz only).

PCF857X I2C constants

◆ PCF8574_I2C_SIZE

#define PCF8574_I2C_SIZE   1

Number of bytes to read/write all pin values.

◆ PCF857X_I2C_MAX_SIZE

#define PCF857X_I2C_MAX_SIZE   2

Maximum number of bytes to read/write all pin values.

Typedef Documentation

◆ PCF857XGPIO

typedef struct _PCF857XGPIO PCF857XGPIO

Note: The PCF857X is a single register device and does not have any direction, pull or configuration registers PCF857X specific types

Function Documentation

◆ pcf8574gpio_create()

GPIO_DEVICE *STDCALL pcf8574gpio_create ( I2C_DEVICE * i2c,
uint16_t address )

Create, register and start a new PCF8574 GPIO device connected to the specified I2C device.

PCF857X Functions

Parameters
I2CThe I2C device this PCF8574 is connected to
AddressThe I2C address for this PCF8574
Returns
Pointer to the new GPIO device or nil on failure

◆ pcf857xgpio_destroy()

uint32_t STDCALL pcf857xgpio_destroy ( GPIO_DEVICE * gpio)

Stop, deregister and destroy a PCF857X GPIO device created by this driver.

Parameters
GPIOThe GPIO device to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure