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.
public static class I2c
Methods
GetFrequency(int bus)
public static int GetFrequency(int bus)
The bus speed in use, in Hz
Returns int
Initialize(int bus, int frequency)
public static void Initialize(int bus, int frequency)
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
| Parameter | Type | Description |
|---|---|---|
bus | int | I2c1, I2c4, I2c5 or I2c6 |
frequency | int | The bus speed in Hz, from 10 kHz to 1 MHz |
UnInitialize(int bus)
public static void UnInitialize(int bus)
Gives the bus's pins back, as they were before Initialize
Fields
DefaultFrequency
public const int DefaultFrequency = 400000
The speed when none is given: 400 kHz (fast mode)
I2c1
public const int I2c1 = 0
I2C1: PD12 (SCL), PD13 (SDA); /dev/i2c-0
I2c4
public const int I2c4 = 2
I2C4: PB6 (SCL), PF15 (SDA); /dev/i2c-2
I2c5
public const int I2c5 = 1
I2C5: PZ4 (SCL), PZ5 (SDA); /dev/i2c-1
I2c6
public const int I2c6 = 3
I2C6: PD1 (SCL), PD0 (SDA); /dev/i2c-3
MaxFrequency
public const int MaxFrequency = 1000000
1 MHz (fast mode plus)
MinFrequency
public const int MinFrequency = 10000
The slowest supported bus speed: 10 kHz.