Skip to main content

I2c Class

Package: GHIElectronics.Endpoint.Core
Namespace: GHIElectronics.Endpoint.Core

The I2C buses bundled with EPM815. Use with .NET's System.Device.I2c. I2c.Initialize connects the bus's pins and sets its speed; then use I2cDevice as usual. Each constant is the bus number for I2cConnectionSettings (/dev/i2c-N), fixed by the firmware.

class I2c: ...

Methods​

GetFrequency(int bus)​

@staticmethod
def GetFrequency(bus: int) -> int:

The bus speed in use, in Hz

Returns int

Initialize(int bus, int frequency)​

@staticmethod
def Initialize(bus: int, frequency: int) -> None:

Connects the bus's pins (open drain, with the internal pull-ups on for boards without their own) and sets its speed, until the next boot

ParameterTypeDescription
busintI2c1, I2c4, I2c5 or I2c6
frequencyintThe bus speed in Hz, from 10 kHz to 1 MHz

UnInitialize(int bus)​

@staticmethod
def UnInitialize(bus: int) -> None:

Gives the bus's pins back, as they were before Initialize

Fields​

DefaultFrequency​

DefaultFrequency: int = 400000

The speed when none is given: 400 kHz (fast mode)

I2c1​

I2c1: int = 0

I2C1: PD12 (SCL), PD13 (SDA); /dev/i2c-0

I2c4​

I2c4: int = 2

I2C4: PB6 (SCL), PF15 (SDA); /dev/i2c-2

I2c5​

I2c5: int = 1

I2C5: PZ4 (SCL), PZ5 (SDA); /dev/i2c-1

I2c6​

I2c6: int = 3

I2C6: PD1 (SCL), PD0 (SDA); /dev/i2c-3

MaxFrequency​

MaxFrequency: int = 1000000

1 MHz (fast mode plus)

MinFrequency​

MinFrequency: int = 10000

The slowest supported bus speed: 10 kHz.