Source code for sensirion_i2c_scd30.commands

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2022 Sensirion AG, Switzerland
#
#     THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator:    sensirion-driver-generator 0.9.1
# Product:      scd30
# Version:      None
#

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


[docs]class StartPeriodicMeasurement(Transfer): CMD_ID = 0x10
[docs] def __init__(self, ambient_pressure): self._ambient_pressure = ambient_pressure
def pack(self): return self.tx_data.pack([self._ambient_pressure]) tx = TxData(CMD_ID, '>HH')
[docs]class StopPeriodicMeasurement(Transfer): CMD_ID = 0x104 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False)
[docs]class SetMeasurementInterval(Transfer): CMD_ID = 0x4600
[docs] def __init__(self, interval): self._interval = interval
def pack(self): return self.tx_data.pack([self._interval]) tx = TxData(CMD_ID, '>HH', device_busy_delay=0.01, slave_address=None, ignore_ack=False)
[docs]class GetMeasurementInterval(Transfer): CMD_ID = 0x4600 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>H')
[docs]class GetDataReady(Transfer): CMD_ID = 0x202 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>H')
[docs]class ReadMeasurementData(Transfer): CMD_ID = 0x300 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>fff')
[docs]class ActivateAutoCalibration(Transfer): CMD_ID = 0x5306
[docs] def __init__(self, do_activate): self._do_activate = do_activate
def pack(self): return self.tx_data.pack([self._do_activate]) tx = TxData(CMD_ID, '>HH', device_busy_delay=0.01, slave_address=None, ignore_ack=False)
[docs]class GetAutoCalibrationStatus(Transfer): CMD_ID = 0x5306 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>H')
[docs]class ForceRecalibration(Transfer): CMD_ID = 0x5204
[docs] def __init__(self, co2_ref_concentration): self._co2_ref_concentration = co2_ref_concentration
def pack(self): return self.tx_data.pack([self._co2_ref_concentration]) tx = TxData(CMD_ID, '>HH', device_busy_delay=0.01, slave_address=None, ignore_ack=False)
[docs]class GetForceRecalibrationStatus(Transfer): CMD_ID = 0x5204 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>H')
[docs]class SetTemperatureOffset(Transfer): CMD_ID = 0x5403
[docs] def __init__(self, temperature_offset): self._temperature_offset = temperature_offset
def pack(self): return self.tx_data.pack([self._temperature_offset]) tx = TxData(CMD_ID, '>HH', device_busy_delay=0.01, slave_address=None, ignore_ack=False)
[docs]class GetTemperatureOffset(Transfer): CMD_ID = 0x5403 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>H')
[docs]class GetAltitudeCompensation(Transfer): CMD_ID = 0x5102 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>H')
[docs]class SetAltitudeCompensation(Transfer): CMD_ID = 0x5102
[docs] def __init__(self, altitude): self._altitude = altitude
def pack(self): return self.tx_data.pack([self._altitude]) tx = TxData(CMD_ID, '>HH', device_busy_delay=0.01, slave_address=None, ignore_ack=False)
[docs]class ReadFirmwareVersion(Transfer): CMD_ID = 0xd100 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=0.01, slave_address=None, ignore_ack=False) rx = RxData('>BB')
[docs]class SoftReset(Transfer): CMD_ID = 0xd304 def pack(self): return self.tx_data.pack([]) tx = TxData(CMD_ID, '>H', device_busy_delay=2.0, slave_address=None, ignore_ack=False)