class ModulinoButtons(Modulino)
1 second
def update()
Update the button status and call the corresponding callbacks. Returns True if any of the buttons has changed its state.
class I2CHelper()
A helper class for interacting with I2C devices on supported boards.
Modulinos operate at 100kHz
@staticmethod
def reset_bus(i2c_bus)
Resets the I2C bus in case it got stuck. To unblock the bus the SDA line is kept high for 20 clock cycles Which causes the triggering of a NAK message.
@staticmethod
def find_interface() -> I2C
Returns an instance of the I2C interface for the current board.
Raises: RuntimeError: If the current board is not supported.
Returns: I2C: An instance of the I2C interface.
class Modulino()
def discover(default_addresses)
Tries to find the given modulino device in the device chain based on the pre-defined default addresses. If the address has been changed to a custom one it won't be found with this function.
def __bool__()
Boolean cast operator to determine if the given i2c device has a correct address and if the bus is defined. In case of auto discovery this also means that the device was found on the bus because otherwise the address would be None.
@property
def connected()
Determines if the given modulino is connected to the i2c bus.
@property
def pin_strap_address()
Returns the pin strap i2c address of the modulino. This address is set via resistors on the modulino board. Since all modulinos generally use the same firmware, the pinstrap address is needed to determine the type of the modulino at boot time, so it know what to do. At boot it checks the internal flash in case its address has been overridden by the user which would take precedence.
def read(amount_of_bytes)
Reads the given amount of bytes from the i2c device and returns the data. It skips the first byte which is the pinstrap address.
def write(data_buffer)
Writes the given buffer to the i2c device.
@property
def has_default_address()
Determines if the given modulino has a default address or if a custom one was set.
@staticmethod
def reset_bus(i2c_bus)
Resets the i2c bus. This is useful when the bus is in an unknown state. The modulinos that are equipped with a micro controller use DMA operations. If the host board does a reset during such operation it can make the bus get stuck.
Returns ---- I2C: A new i2c bus object after resetting the bus.
class ModulinoColor()
def __int__()
Return the 32-bit integer representation of the color.
class ModulinoThermo(Modulino)
@property
def measurements() -> Measurement
Return Temperature and Relative Humidity or None if the data is stalled
@property
def relative_humidity() -> float
The current relative humidity in % rH
@property
def temperature() -> float
The current temperature in Celsius