Class SoftI2cBus
Provides a software based (bit-banged) I2C bus on 2 pins.
Implements
Inherited Members
Namespace: Unosquare.PiGpio.ManagedModel
Syntax
public sealed class SoftI2cBus : IDisposable
Fields
DefaultBaudRate
The default baud rate for a software-based I2C bus Baud rate can go up to 500kbits per second.
Declaration
public const int DefaultBaudRate = 100000
Field Value
Type | Description |
---|---|
Int32 |
Properties
BaudRate
Gets the baud rate.
Declaration
public int BaudRate { get; }
Property Value
Type | Description |
---|---|
Int32 |
ClockPin
Gets the clock pin.
Declaration
public GpioPin ClockPin { get; }
Property Value
Type | Description |
---|---|
GpioPin |
DataPin
Gets the data pin.
Declaration
public GpioPin DataPin { get; }
Property Value
Type | Description |
---|---|
GpioPin |
Handle
Gets or the I2C bus handle. This points to the SDA (data) pin of the I2C bus.
Declaration
public UserGpio Handle { get; }
Property Value
Type | Description |
---|---|
UserGpio |
Methods
Dispose()
Declaration
public void Dispose()
Read(Byte, Int32)
Reads data from the specified address.
Declaration
public byte[] Read(byte address, int count)
Parameters
Type | Name | Description |
---|---|---|
Byte | address | The address. |
Int32 | count | The count. Recommended 32 as maximum. |
Returns
Type | Description |
---|---|
Byte[] | The byte array that was read. |
Write(Byte, Byte[])
Writes data to the specified address.
Declaration
public void Write(byte address, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte | address | The address. |
Byte[] | buffer | The buffer. Recommended 32 bytes max. |