Skip to content

TMiletusRaspberryI2C

I²C is a standard 2 wire protocol to communicate with devices. The Raspberry Pi offers out of the box two I²C interfaces. There is SCLK and SDA signal, i.e. the clock signal and the data signal that is open-collector based input / output. Communicating over I²C works via sending first an 8bit address and read or write bit over the SDA signal and then either write or read data bits. Below is a list of available properties, methods and events for TMiletusRaspberryI2C.

Properties for TMiletusRaspberryI2C

Property Description
I2CAddress: Integer Address of the I²C device

Methods for TMiletusRaspberryI2C

Method Description
Open Open the connection
Close Close the connection
WriteByte(AAddress: Byte; AData: Byte) Write a byte to a register address
WriteByteP(AAddress: Byte; AData: Byte): TJSPromise Promise based equivalent of WriteByte
WriteAddress(AAddress: Byte)
WriteAddressP(AAddress: Byte): TJSPromise Promise based equivalend of WriteAddress
WriteBuffer(ABytes: array of Byte; ASize: Integer) Write a buffer of data to a register address
WriteBufferP(ABytes: array of Byte; ASize: Integer) Promise based equivalent of WriteBuffer
ReadByte(AAddress: Byte): TJSPromise Read a byte from a given register address
ReadSmallInt(AAddress: Byte): TJSPromise Read a SmallInt from a given register address
ReadBuffer(AAddress: Byte; ASize: Integer) Read a buffer of data from a given register address

Events for TMiletusRaspberryI2C

Event Description
OnOpen Event triggered when the connection is opened
OnClose Event triggered when the connection is closed