Source code for sensirion_i2c_sfx6xxx.commands

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2024 Sensirion AG, Switzerland
#
#     THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator:     sensirion-driver-generator 0.40.1
# Product:       sfx6xxx
# Model-Version: 2.3.1
#
"""
The transfer classes specify the data that is transferred between host and sensor. The generated transfer classes
are used by the driver class and not intended for direct use.
"""

from enum import Enum
from sensirion_driver_adapters.transfer import Transfer
from sensirion_driver_adapters.rx_tx_data import TxData, RxData
from sensirion_driver_support_types.bitfield import BitField, BitfieldContainer


[docs]class StatusWordT(BitfieldContainer): gas_conc = BitField(offset=0, width=10) pressure_controller_functionality = BitField(offset=10, width=1) flow_controller_functionality = BitField(offset=11, width=1) command_code = BitField(offset=12, width=4)
[docs]class FlowUnitT(BitfieldContainer): prefix = BitField(offset=0, width=4) time_base = BitField(offset=4, width=4) unit = BitField(offset=8, width=5)
[docs]class ErrorCodeT(Enum): I2C_ERROR = 0 TIMEOUT = 1 def __int__(self): return self.value
[docs]class ReadProductIdentifier(Transfer): """Read product identifier and the serial number.""" CMD_ID = 0xe102
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H') rx = RxData(descriptor='>I8B', convert_to_int=True)
[docs]class ResetPointerToMeasurementBuffer(Transfer): """ This instruction resets the I2C address pointer to the regular result output buffer such that the measurement data are obtained upon a subsequent read header. """ CMD_ID = 0xe000
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')
[docs]class UpdateSetpoint(Transfer): """ Set the flow setpoint as a physical value which is used by the flow controller as reference input. """ CMD_ID = 0xf054 def __init__(self, setpoint): self._setpoint = setpoint
[docs] def pack(self): return self.tx_data.pack([self._setpoint])
tx = TxData(CMD_ID, '>Hh')
[docs]class UpdateInitStep(Transfer): """ This instruction transmits the InitStep value to the MFC. An MFC variant specific InitStep value is used by default, which will be applied after a hard- or soft-reset of the sensor. """ CMD_ID = 0xe1b9 def __init__(self, init_step): self._init_step = init_step
[docs] def pack(self): return self.tx_data.pack([self._init_step])
tx = TxData(CMD_ID, '>HH')
[docs]class UpdateCustomerGain(Transfer): """ This instruction transmits the CustomerGain value to the MFC. A value of 1 is used by default for the CustomerGain, which will be applied after a hard- or soft-reset of the sensor. """ CMD_ID = 0xe1b2 def __init__(self, customer_gain): self._customer_gain = customer_gain
[docs] def pack(self): return self.tx_data.pack([self._customer_gain])
tx = TxData(CMD_ID, '>HH')
[docs]class StartO2ContinuousMeasurement(Transfer): """Start continuous O₂ measurement.""" CMD_ID = 0x3603
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.012, slave_address=None, ignore_ack=False)
[docs]class StartAirContinuousMeasurement(Transfer): """Start continuous air measurement.""" CMD_ID = 0x3608
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.012, slave_address=None, ignore_ack=False)
[docs]class StartCo2ContinuousMeasurement(Transfer): """Start continuous CO₂ measurement.""" CMD_ID = 0x3615
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.012, slave_address=None, ignore_ack=False)
[docs]class StartN2oContinuousMeasurement(Transfer): """Start continuous N₂O measurement.""" CMD_ID = 0x361e
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.012, slave_address=None, ignore_ack=False)
[docs]class StartArContinuousMeasurement(Transfer): """Start continuous Ar measurement.""" CMD_ID = 0x3624
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.012, slave_address=None, ignore_ack=False)
[docs]class StartRawThermalConductivityContinuousMeasurement(Transfer): """ Start measurement for raw thermal conductivity. In this measurement mode the valve remains closed and the flow value is replaced by the raw thermal conductivity value. """ CMD_ID = 0x3624
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.05, slave_address=None, ignore_ack=False)
[docs]class StartO2InAirContinuousMeasurement(Transfer): """Start continuous measurement for gas mixture of O2 in Air.""" CMD_ID = 0x3650 def __init__(self, volume_fraction): self._volume_fraction = volume_fraction
[docs] def pack(self): return self.tx_data.pack([self._volume_fraction])
tx = TxData(CMD_ID, '>HH', device_busy_delay=0.012, slave_address=None, ignore_ack=False)
[docs]class StopContinuousMeasurement(Transfer): """This transfer stops the continuous measurement and puts the sensor in idle mode.""" CMD_ID = 0x3ff9
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H', device_busy_delay=0.001, slave_address=None, ignore_ack=False)
[docs]class ReadMeasurementData(Transfer): """Read out the data from the sensor."""
[docs] def pack(self): return None
rx = RxData('>hhH')
[docs]class ReadFlow(Transfer): """Read out the flow only from the sensor."""
[docs] def pack(self): return None
rx = RxData('>h')
[docs]class GetRawTemperature(Transfer): """ While the sensor is in continuous measurement mode, the temperature of the bulk silicon in the flow-sensor chip can be read with a special I2C transmission sequence. The sensor must be in continuous measurement mode and the temperature is read without interrupting the running measurement. To this end a transmission sequence consisting of multiple instructions is detailed in this section. """ CMD_ID = 0xe102
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H') rx = RxData('>h')
[docs]class ForceOpenValve(Transfer): """ Fully opens the valve. The flow value can still be read from the sensor. Call reset_force_open_valve to return to normal valve regulation. """ CMD_ID = 0x3fe4
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')
[docs]class ResetForceOpenValve(Transfer): """Return to normal valve regulation after fully opening the valve.""" CMD_ID = 0x3f65
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')
[docs]class ForceCloseValve(Transfer): """ Fully closes the valve. The flow value can still be read from the sensor. Call reset_force_close_valve to return to normal valve regulation. """ CMD_ID = 0x3fef
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')
[docs]class ResetForceCloseValve(Transfer): """Return to normal valve regulation after force closing the valve.""" CMD_ID = 0x3f6e
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')
[docs]class UpdateGasConcentration(Transfer): """Update the concentration of a binary gas mixture dynamically.""" CMD_ID = 0xe17d def __init__(self, volume_fraction): self._volume_fraction = volume_fraction
[docs] def pack(self): return self.tx_data.pack([self._volume_fraction])
tx = TxData(CMD_ID, '>HH')
[docs]class PrepareReadGasCalibration(Transfer): """This command prepares read out of gas calibration.""" CMD_ID = 0x3661 def __init__(self, measurement_command): self._measurement_command = measurement_command
[docs] def pack(self): return self.tx_data.pack([self._measurement_command])
tx = TxData(CMD_ID, '>HH')
[docs]class ReadGasCalibration(Transfer): """ Read the flow scale, offset and unit, full-scale flow and unique gas-ID for one of the calibrated gases. """ CMD_ID = 0xe151
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H') rx = RxData('>hhHhH')
[docs]class EnableRawFlowValues(Transfer): """ There might be special cases where it is beneficial to read the uncalibrated raw flow value from the sensor. To this end a dedicated command can be issued requesting the sensor to return the uncalibrated raw flow values as opposed to the default linearized flow values. """ CMD_ID = 0x3fde
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')
[docs]class DisableRawFlowValues(Transfer): """Causes the sensor to switch back to normalized flow values.""" CMD_ID = 0x3f5f
[docs] def pack(self): return self.tx_data.pack([])
tx = TxData(CMD_ID, '>H')