Source code for sensirion_i2c_sts3x.result_types

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2023 Sensirion AG, Switzerland
#
#     THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator:     sensirion-driver-generator 0.33.0
# Product:       sts3x
# Model-Version: 1.0.0
#
"""
The signal classes specify transformations of the raw sensor signals into a meaningful units.
The generated signal types are used by the driver class and not intended for direct use.
"""

from sensirion_driver_support_types.signals import AbstractSignal


[docs]class SignalTemperature(AbstractSignal): """Converted from ticks to degrees celsius by -45 + (175 * value / 65535)""" def __init__(self, temperature_ticks): self._temperature = float(temperature_ticks) self._temperature = -45 + ((self._temperature * 175.0) / 65535.0) @property def value(self): return self._temperature def __str__(self): return '{0:.2f}'.format(self.value)