Difference between revisions of "Unit MCP230XX"
Line 86: | Line 86: | ||
<br /> | <br /> | ||
+ | '''MCP230XX GPIO functions''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOStart(GPIO:PGPIODevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceStart API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceStart instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOStop(GPIO:PGPIODevice):LongWord; </pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceStop API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceStop instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIORead(GPIO:PGPIODevice; Reg:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceRead API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceRead instead | ||
+ | Will read only a single register byte | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">procedure MCP230XXGPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceWrite API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceWrite instead | ||
+ | Will write only a single register byte | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceInputGet API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceInputGet instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceOutputSet API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceOutputSet instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOPullGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODevicePullGet API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODevicePullGet instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODevicePullSelect API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODevicePullSelect instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceFunctionGet API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceFunctionGet instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
+ | <pre style="border: 0; padding-bottom:0px;">function MCP230XXGPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of GPIODeviceFunctionSelect API for MCP230XX</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | Not intended to be called directly by applications, use GPIODeviceFunctionSelect instead | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
Return to [[Unit_Reference|Unit Reference]] | Return to [[Unit_Reference|Unit Reference]] |
Revision as of 00:58, 14 October 2016
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
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
MCP230XX functions
function MCP23008GPIOCreate(I2C:PI2CDevice; Address:Word):PGPIODevice;
I2C | The I2C device this MCP23008 is connected to |
---|---|
Address | The I2C address for this MCP23008 |
Return | Pointer to the new GPIO device or nil on failure |
function MCP23017GPIOCreate(I2C:PI2CDevice; Address:Word):PGPIODevice;
I2C | The I2C device this MCP23017 is connected to |
---|---|
Address | The I2C address for this MCP23017 |
Return | Pointer to the new GPIO device or nil on failure |
function MCP230XXGPIODestroy(GPIO:PGPIODevice):LongWord;
GPIO | The GPIO device to destroy |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
MCP230XX GPIO functions
function MCP230XXGPIOStart(GPIO:PGPIODevice):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceStart instead |
---|
function MCP230XXGPIOStop(GPIO:PGPIODevice):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceStop instead |
---|
function MCP230XXGPIORead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceRead instead
Will read only a single register byte |
---|
procedure MCP230XXGPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
Note | Not intended to be called directly by applications, use GPIODeviceWrite instead
Will write only a single register byte |
---|
function MCP230XXGPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceInputGet instead |
---|
function MCP230XXGPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceOutputSet instead |
---|
function MCP230XXGPIOPullGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODevicePullGet instead |
---|
function MCP230XXGPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODevicePullSelect instead |
---|
function MCP230XXGPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceFunctionGet instead |
---|
function MCP230XXGPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Note | Not intended to be called directly by applications, use GPIODeviceFunctionSelect instead |
---|
Return to Unit Reference