The I2CPort class writes to and reads from the I2C bus On Chip Peripheral (OCP) device integrated into the Raspberry Pi CPU via the I2CDev device driver access method. At this time there is no RPICSIO class of similar functionality which uses the Memory Mapped access method.
IMPORTANT NOTE: Before creating any RPICSIO Port class you will need to ensure that the RPICSIO Library knows which type of Raspberry Pi you are dealing with. This is done by executing a call (only once is necessary) like the one below somewhere in your code before you create any port.
RPICSIOConfig.Instance.RPIType = RPITypeEnum.RPITYPE_RPI2;
public class I2CPortFS : PortFS
public I2CPortFS(I2CPortEnum i2cPortIn) : base(GpioEnum.GPIO_NONE)
public override void ClosePort()
public void Dispose()
public override PortDirectionEnum PortDirection()
public void Read(int devID, byte[] rxByteBuf, int numBytes)
The address of the I2C device is specified by the devID. You do not need to include the address as the first outgoing byte in the rxByteBuf or set the READ/WRITE bit in that address. The I2C driver does that and sends it for you automatically.
public void Write(int devID, byte[] txByteBuf, int numBytes)
The address of the I2C device is specified by the devID. You do not need to include the address as the first outgoing byte in the txByteBuf or set the READ/WRITE bit in that address. The I2C driver does that and sends it for you automatically.
public I2CPortEnum I2CPort { get; }