Source code for herosdevices.core.templates.i2c
"""Templates for devices connected via I2C."""
from herosdevices.core.bus.i2c import I2CConnection
[docs]
class I2CDeviceTemplate:
"""Template (base class) for devices connected via I2C.
Inheriting from this class gives device drivers access to an
I2CConnection instance via self.connection.
"""
def __init__(self, bus_id: int = 1, keep_alive: bool = True) -> None:
self.connection = I2CConnection(bus_id, keep_alive=keep_alive)