Unit MCP230XX

From Ultibo.org
Revision as of 05:38, 13 December 2016 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


The Microchip MCP23008 and MCP23017 are 8 or 16 bit I/O expanders that provide 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 MCP230XX 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 MCP23008GPIOCreate or MCP23017GPIOCreate and pass an I2C device and address. The functions 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.

Both devices also come in an SPI interface version, these are not currently supported by this unit.

Note: This unit does not currently implement the interrupt capabilities of the MCP230XX 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 MCP230XX chips.

Constants



[Expand]
MCP230XX specific constants MCP23008_*


[Expand]
MCP230XX chip constants MCP230XX_CHIP_*


[Expand]
MCP230XX I2C constants MCP230XX_I2C_*


Type definitions


To be documented

Public variables


To be documented

Function declarations



MCP230XX functions

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


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


[Expand]
function MCP230XXGPIODestroy(GPIO:PGPIODevice):LongWord;
Description: Stop, deregister and destroy an MCP230XX GPIO device created by this driver


MCP230XX GPIO functions

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


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


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


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


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


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


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


[Expand]
function MCP230XXGPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: Implementation of GPIODevicePullSelect API for MCP230XX


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


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


Return to Unit Reference