I2C Devices Classes

From FlightGear wiki
Jump to navigation Jump to search

I2C devices are hardware drivers on which all cockpit stuff are connected. Switch, Segments Display, Rotary Encoder ... etc are manage by a device. Each device type has it own driver (library).

Devices included in the interface package will be describe from here. For each of them, you will find an example of configuration and informations about the device class and methods(class function).

In a standard configuration, the driver functions should not be called directly. As usual, there are exceptions.

Each driver encapsulates the DeviceI2C Comunication class which it will handle frames on the I2C bus with low level calls

There are however some calls that will be made directly on the device.

To understand, these chips contain oscillators that manage the internal operation.

These hardware drivers are managed by positioning 8-bit binary words in various registers conditioning the operation of the chip. It is that that the classes of the drivers realizes, bringing a simpler use. Rather than having low-level methods like WriteBuffer() or ReadBit(), which are actually methods of the Comunication class DeviceI2C and take hex-decimal type arguments, with driver class you have access to methods like setBrightness() or getInput() that are much clearer and understandable about their function.