Difference between revisions of "Unit I2C"
Line 40: | Line 40: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <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 I2CInit;</pre> | <pre style="border: 0; padding-bottom:0px;">procedure I2CInit;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''I2C 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 I2CDeviceStart(I2C:PI2CDevice; Rate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the specified I2C device ready for reading and writing</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to start | ||
+ | |- | ||
+ | ! '''Rate''' | ||
+ | | The clock rate to set for the device (0 to use the default rate | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceStop(I2C:PI2CDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the specified I2C device and terminate reading and writing</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to stop | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceRead(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read data from the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to read from | ||
+ | |- | ||
+ | ! '''Address''' | ||
+ | | The slave address to read from (I2C_ADDRESS_INVALID to use the current address) | ||
+ | |- | ||
+ | ! '''Buffer''' | ||
+ | | Pointer to a buffer to receive the data | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the buffer | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of bytes read on return | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceWrite(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write data to the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to write to | ||
+ | |- | ||
+ | ! '''Address''' | ||
+ | | The slave address to write to (I2C_ADDRESS_INVALID to use the current address) | ||
+ | |- | ||
+ | ! '''Buffer''' | ||
+ | | Pointer to a buffer of data to transmit | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the buffer | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of bytes written on return | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceWriteRead(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write data to and Read data from the specified I2C device in one operation. Useful for devices that require a register address specified before a read (eg EEPROM devices)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to write to and read from | ||
+ | |- | ||
+ | ! '''Address''' | ||
+ | | The slave address to write to (I2C_ADDRESS_INVALID to use the current address) | ||
+ | |- | ||
+ | ! '''Initial''' | ||
+ | | Pointer to the initial buffer to transmit | ||
+ | |- | ||
+ | ! '''Len''' | ||
+ | | The size of the initial buffer | ||
+ | |- | ||
+ | ! '''Data''' | ||
+ | | Pointer to a buffer to receive the data | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the data buffer | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of bytes read on return | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceWriteWrite(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write 2 data blocks to the specified I2C device in one operation. Useful for devices that require a register address specified before a write (eg EEPROM devices)</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to write to | ||
+ | |- | ||
+ | ! '''Address''' | ||
+ | | The slave address to write to (I2C_ADDRESS_INVALID to use the current address) | ||
+ | |- | ||
+ | ! '''Initial''' | ||
+ | | Pointer to the initial buffer to transmit | ||
+ | |- | ||
+ | ! '''Len''' | ||
+ | | The size of the initial buffer | ||
+ | |- | ||
+ | ! '''Data''' | ||
+ | | Pointer to a buffer of data to transmit | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | The size of the data buffer | ||
+ | |- | ||
+ | ! '''Count''' | ||
+ | | The number of bytes of data written on return | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceGetRate(I2C:PI2CDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the clock rate of the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to get the clock rate from | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | The clock rate in Hz or 0 on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceSetRate(I2C:PI2CDevice; Rate:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the clock rate for the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to set the clock rate for | ||
+ | |- | ||
+ | ! '''Rate''' | ||
+ | | The clock rate to set in Hz | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceGetAddress(I2C:PI2CDevice):Word;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the slave address for the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to get the slave address from | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | The slave address or I2C_ADDRESS_INVALID on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceSetAddress(I2C:PI2CDevice; Address:Word):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the slave address for the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to set the slave address for | ||
+ | |- | ||
+ | ! '''Address''' | ||
+ | | The slave address to set | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceProperties(I2C:PI2CDevice; Properties:PI2CProperties):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified I2C device</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''I2C''' | ||
+ | | The I2C device to get properties from | ||
+ | |- | ||
+ | ! '''Properties''' | ||
+ | | Pointer to a TI2CProperties structure to fill in | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceCreate:PI2CDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new I2C entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to new I2C entry or nil if I2C could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceCreateEx(Size:LongWord):PI2CDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new I2C entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Size''' | ||
+ | | Size in bytes to allocate for new I2C (Including the I2C entry) | ||
+ | |- | ||
+ | ! '''Return''' | ||
+ | | Pointer to new I2C entry or nil if I2C could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceDestroy(I2C:PI2CDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing I2C entry</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceRegister(I2C:PI2CDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new I2C in the I2C table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceDeregister(I2C:PI2CDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister a I2C from the I2C table</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceFind(I2CId:LongWord):PI2CDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceFindByName(const Name:String):PI2CDevice; inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceFindByDescription(const Description:String):PI2CDevice; inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceEnumerate(Callback:TI2CEnumerate; Data:Pointer):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! '''Note''' | ||
+ | | To be documented | ||
+ | |- | ||
+ | |} | ||
+ | </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 I2CDeviceNotification(I2C:PI2CDevice; Callback:TI2CNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre> | ||
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> |
Revision as of 06:03, 18 August 2016
Return to Unit Reference
Description
I2C (Inter-Integrated Circuit) is a serial bus for communication between peripheral components.
Originally invented by Phillips the I2C protocol is used by thousands of common chips that perform a wide range of tasks such as real time clocks, temperature and other sensors, small LCD displays and many more.
Each device is assigned a 7bit address which is used by the host (or master) to signal the device that a message written to the bus is intended for that device or that the host wants to read data from that device.
Speeds range from 10Kbps to 3.4Mbps although the typical speed is either 100Kbps or 400Kbps.
This unit implements the standardized interface for I2C devices and allows reading or writing to a specific address, setting a clock rate for the communication and determining device properties.
For the purpose of this interface a device is the I2C controller attached to the local system and may be either a master or a slave. Since the protocol does not include any form of enumeration or identification the interface does not attempt to represent the devices connected to the bus,any driver written to communicate with a connected I2C device should know (or allow configuration of) the address to read and write to and the specific message format required for that device. The Intel System Management Bus (SMBus) is a variation of the I2C bus and in certain cases the two are compatible with each other.
Constants
To be documented
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
procedure I2CInit;
Note | To be documented |
---|
I2C functions
function I2CDeviceStart(I2C:PI2CDevice; Rate:LongWord):LongWord;
I2C | The I2C device to start |
---|---|
Rate | The clock rate to set for the device (0 to use the default rate |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceStop(I2C:PI2CDevice):LongWord;
I2C | The I2C device to stop |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceRead(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
I2C | The I2C device to read from |
---|---|
Address | The slave address to read from (I2C_ADDRESS_INVALID to use the current address) |
Buffer | Pointer to a buffer to receive the data |
Size | The size of the buffer |
Count | The number of bytes read on return |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceWrite(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
I2C | The I2C device to write to |
---|---|
Address | The slave address to write to (I2C_ADDRESS_INVALID to use the current address) |
Buffer | Pointer to a buffer of data to transmit |
Size | The size of the buffer |
Count | The number of bytes written on return |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceWriteRead(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;
I2C | The I2C device to write to and read from |
---|---|
Address | The slave address to write to (I2C_ADDRESS_INVALID to use the current address) |
Initial | Pointer to the initial buffer to transmit |
Len | The size of the initial buffer |
Data | Pointer to a buffer to receive the data |
Size | The size of the data buffer |
Count | The number of bytes read on return |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceWriteWrite(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;
I2C | The I2C device to write to |
---|---|
Address | The slave address to write to (I2C_ADDRESS_INVALID to use the current address) |
Initial | Pointer to the initial buffer to transmit |
Len | The size of the initial buffer |
Data | Pointer to a buffer of data to transmit |
Size | The size of the data buffer |
Count | The number of bytes of data written on return |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceGetRate(I2C:PI2CDevice):LongWord;
I2C | The I2C device to get the clock rate from |
---|---|
Return | The clock rate in Hz or 0 on failure |
function I2CDeviceSetRate(I2C:PI2CDevice; Rate:LongWord):LongWord;
I2C | The I2C device to set the clock rate for |
---|---|
Rate | The clock rate to set in Hz |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceGetAddress(I2C:PI2CDevice):Word;
I2C | The I2C device to get the slave address from |
---|---|
Return | The slave address or I2C_ADDRESS_INVALID on failure |
function I2CDeviceSetAddress(I2C:PI2CDevice; Address:Word):LongWord;
I2C | The I2C device to set the slave address for |
---|---|
Address | The slave address to set |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceProperties(I2C:PI2CDevice; Properties:PI2CProperties):LongWord;
I2C | The I2C device to get properties from |
---|---|
Properties | Pointer to a TI2CProperties structure to fill in |
Return | ERROR_SUCCESS if completed or another error code on failure |
function I2CDeviceCreate:PI2CDevice;
Return | Pointer to new I2C entry or nil if I2C could not be created |
---|
function I2CDeviceCreateEx(Size:LongWord):PI2CDevice;
Size | Size in bytes to allocate for new I2C (Including the I2C entry) |
---|---|
Return | Pointer to new I2C entry or nil if I2C could not be created |
function I2CDeviceDestroy(I2C:PI2CDevice):LongWord;
Note | To be documented |
---|
function I2CDeviceRegister(I2C:PI2CDevice):LongWord;
Note | To be documented |
---|
function I2CDeviceDeregister(I2C:PI2CDevice):LongWord;
Note | To be documented |
---|
function I2CDeviceFind(I2CId:LongWord):PI2CDevice;
Note | To be documented |
---|
function I2CDeviceFindByName(const Name:String):PI2CDevice; inline;
Note | To be documented |
---|
function I2CDeviceFindByDescription(const Description:String):PI2CDevice; inline;
Note | To be documented |
---|
function I2CDeviceEnumerate(Callback:TI2CEnumerate; Data:Pointer):LongWord;
Note | To be documented |
---|
function I2CDeviceNotification(I2C:PI2CDevice; Callback:TI2CNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Note | To be documented |
---|
Return to Unit Reference