CO2, humidity, and temperature sensor
SCD30.h@2:0d0174b46fd3, 2021-05-07 (annotated)
- Committer:
- mcm
- Date:
- Fri May 07 13:06:14 2021 +0000
- Revision:
- 2:0d0174b46fd3
- Parent:
- 1:c5b8dc5cdcee
- Child:
- 3:ca833b38050f
The driver is completed and ready to be tested.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mcm | 1:c5b8dc5cdcee | 1 | /** |
mcm | 1:c5b8dc5cdcee | 2 | * @brief SCD30.h |
mcm | 1:c5b8dc5cdcee | 3 | * @details CO2, humidity and temperature sensor. |
mcm | 1:c5b8dc5cdcee | 4 | * Header file. |
mcm | 1:c5b8dc5cdcee | 5 | * |
mcm | 1:c5b8dc5cdcee | 6 | * |
mcm | 1:c5b8dc5cdcee | 7 | * @return N/A |
mcm | 1:c5b8dc5cdcee | 8 | * |
mcm | 1:c5b8dc5cdcee | 9 | * @author Manuel Caballero |
mcm | 1:c5b8dc5cdcee | 10 | * @date 07/May/2021 |
mcm | 1:c5b8dc5cdcee | 11 | * @version 07/May/2021 The ORIGIN |
mcm | 1:c5b8dc5cdcee | 12 | * @pre N/A |
mcm | 1:c5b8dc5cdcee | 13 | * @warning N/A |
mcm | 1:c5b8dc5cdcee | 14 | * @pre This code belongs to Nimbus Centre ( http://www.nimbus.cit.ie ). |
mcm | 1:c5b8dc5cdcee | 15 | */ |
mcm | 1:c5b8dc5cdcee | 16 | #ifndef SCD30_H_ |
mcm | 1:c5b8dc5cdcee | 17 | #define SCD30_H_ |
mcm | 1:c5b8dc5cdcee | 18 | |
mcm | 1:c5b8dc5cdcee | 19 | #include "mbed.h" |
mcm | 1:c5b8dc5cdcee | 20 | |
mcm | 1:c5b8dc5cdcee | 21 | |
mcm | 1:c5b8dc5cdcee | 22 | /** |
mcm | 1:c5b8dc5cdcee | 23 | Example: |
mcm | 1:c5b8dc5cdcee | 24 | |
mcm | 1:c5b8dc5cdcee | 25 | @code |
mcm | 1:c5b8dc5cdcee | 26 | |
mcm | 1:c5b8dc5cdcee | 27 | @endcode |
mcm | 1:c5b8dc5cdcee | 28 | */ |
mcm | 1:c5b8dc5cdcee | 29 | |
mcm | 1:c5b8dc5cdcee | 30 | |
mcm | 1:c5b8dc5cdcee | 31 | /*! |
mcm | 1:c5b8dc5cdcee | 32 | Library for the SCD30 CO2, humidity and temperature sensor. |
mcm | 1:c5b8dc5cdcee | 33 | */ |
mcm | 1:c5b8dc5cdcee | 34 | class SCD30 |
mcm | 1:c5b8dc5cdcee | 35 | { |
mcm | 1:c5b8dc5cdcee | 36 | public: |
mcm | 1:c5b8dc5cdcee | 37 | /** |
mcm | 1:c5b8dc5cdcee | 38 | * @brief DEFAULT ADDRESS |
mcm | 1:c5b8dc5cdcee | 39 | */ |
mcm | 1:c5b8dc5cdcee | 40 | typedef enum { |
mcm | 2:0d0174b46fd3 | 41 | SCD30_ADDRESS = ( 0x61 << 1U ) /*!< SCD30 ADDR */ |
mcm | 1:c5b8dc5cdcee | 42 | } SCD30_address_t; |
mcm | 1:c5b8dc5cdcee | 43 | |
mcm | 1:c5b8dc5cdcee | 44 | |
mcm | 1:c5b8dc5cdcee | 45 | |
mcm | 1:c5b8dc5cdcee | 46 | /** |
mcm | 1:c5b8dc5cdcee | 47 | * @brief COMMAND REGISTERS |
mcm | 1:c5b8dc5cdcee | 48 | */ |
mcm | 1:c5b8dc5cdcee | 49 | typedef enum { |
mcm | 1:c5b8dc5cdcee | 50 | SCD30_TRIGGERS_CONTINUOUS_MEASUREMENT = 0x0010, /*!< Triggers continuous measurement. Ambient pressure is optional */ |
mcm | 1:c5b8dc5cdcee | 51 | SCD30_STOP_CONTINUOUS_MEASUREMENT = 0x0104, /*!< Stop continuous measurement */ |
mcm | 1:c5b8dc5cdcee | 52 | SCD30_SET_MEASUREMENT_INTERVAL = 0x4600, /*!< Set measurement interval for continuous measurement mode */ |
mcm | 1:c5b8dc5cdcee | 53 | SCD30_GET_DATA_READY_STATUS = 0x0202, /*!< Data ready status */ |
mcm | 1:c5b8dc5cdcee | 54 | SCD30_READ_MEASUREMENT = 0x0300, /*!< Reads a single measurement of C02 concentration */ |
mcm | 1:c5b8dc5cdcee | 55 | SCD30_CONTINUOUS_AUTOMATIC_SELF_CALIBRATION = 0x5306, /*!< Continuous automatic self-calibration can be (de-)activated */ |
mcm | 1:c5b8dc5cdcee | 56 | SCD30_SET_FORCED_RECALIBRATION = 0x5204, /*!< Forced recalibration (FRC) */ |
mcm | 1:c5b8dc5cdcee | 57 | SCD30_SET_TEMPERATURE_OFFSET = 0x5403, /*!< Temperature offset */ |
mcm | 1:c5b8dc5cdcee | 58 | SCD30_SET_ALTITUDE_COMPENSATION = 0x5102, /*!< Altitude compensation */ |
mcm | 1:c5b8dc5cdcee | 59 | SCD30_FIRMWARE_VERSION = 0xD100, /*!< Firmware version */ |
mcm | 1:c5b8dc5cdcee | 60 | SCD30_SOFTRESET = 0xD304 /*!< Software reset: Restart the sensor */ |
mcm | 1:c5b8dc5cdcee | 61 | } SCD30_command_registers_t; |
mcm | 1:c5b8dc5cdcee | 62 | |
mcm | 1:c5b8dc5cdcee | 63 | |
mcm | 1:c5b8dc5cdcee | 64 | |
mcm | 1:c5b8dc5cdcee | 65 | /** |
mcm | 1:c5b8dc5cdcee | 66 | * @brief GET DATA READY STATUS. |
mcm | 1:c5b8dc5cdcee | 67 | * NOTE: N/A. |
mcm | 1:c5b8dc5cdcee | 68 | */ |
mcm | 1:c5b8dc5cdcee | 69 | /* BIT <0> |
mcm | 1:c5b8dc5cdcee | 70 | * NOTE: N/A. |
mcm | 1:c5b8dc5cdcee | 71 | */ |
mcm | 1:c5b8dc5cdcee | 72 | typedef enum { |
mcm | 1:c5b8dc5cdcee | 73 | GET_READY_STATUS_BIT_MASK = ( 1U << 0U ), /*!< BIT mask */ |
mcm | 1:c5b8dc5cdcee | 74 | GET_READY_STATUS_BIT_DATA_NO_READY = ( 0U << 0U ), /*!< Measurement is not ready to be read from the sensor */ |
mcm | 1:c5b8dc5cdcee | 75 | GET_READY_STATUS_BIT_DATA_READY = ( 1U << 0U ) /*!< Measurement is ready to be read from the sensor */ |
mcm | 1:c5b8dc5cdcee | 76 | } SCD30_get_ready_status_bit_t; |
mcm | 1:c5b8dc5cdcee | 77 | |
mcm | 1:c5b8dc5cdcee | 78 | |
mcm | 1:c5b8dc5cdcee | 79 | /** |
mcm | 1:c5b8dc5cdcee | 80 | * @brief CONTINUOUS AUTOMATIC SELF CALIBRATION. |
mcm | 1:c5b8dc5cdcee | 81 | * NOTE: N/A. |
mcm | 1:c5b8dc5cdcee | 82 | */ |
mcm | 1:c5b8dc5cdcee | 83 | /* ASC <0> |
mcm | 1:c5b8dc5cdcee | 84 | * NOTE: N/A. |
mcm | 1:c5b8dc5cdcee | 85 | */ |
mcm | 1:c5b8dc5cdcee | 86 | typedef enum { |
mcm | 1:c5b8dc5cdcee | 87 | CONTINUOUS_AUTOMATIC_SELF_CALIBRATION_ASC_MASK = ( 1U << 0U ), /*!< ASC mask */ |
mcm | 1:c5b8dc5cdcee | 88 | CONTINUOUS_AUTOMATIC_SELF_CALIBRATION_ASC_DEACTIVATE = ( 0U << 0U ), /*!< Deactivate continuous ASC */ |
mcm | 1:c5b8dc5cdcee | 89 | CONTINUOUS_AUTOMATIC_SELF_CALIBRATION_ASC_ACTIVATE = ( 1U << 0U ) /*!< Activate continuous ASC */ |
mcm | 1:c5b8dc5cdcee | 90 | } SCD30_continuous_auto_selfcal_t; |
mcm | 1:c5b8dc5cdcee | 91 | |
mcm | 1:c5b8dc5cdcee | 92 | |
mcm | 1:c5b8dc5cdcee | 93 | /** |
mcm | 1:c5b8dc5cdcee | 94 | * @brief CRC-8. |
mcm | 1:c5b8dc5cdcee | 95 | * NOTE: Polynomial: 0x31 (x^8 + x^5 + x^4 + 1) |
mcm | 1:c5b8dc5cdcee | 96 | * Initialization: 0xFF |
mcm | 1:c5b8dc5cdcee | 97 | * Final XOR: 0x00. |
mcm | 1:c5b8dc5cdcee | 98 | */ |
mcm | 1:c5b8dc5cdcee | 99 | #define SCD30_CRC8_POLYNOMIAL 0x31 /*!< SCD30 CRC-8: Polynomial */ |
mcm | 1:c5b8dc5cdcee | 100 | #define SCD30_CRC8_INITIALIZATION 0xFF /*!< SCD30 CRC-8: Initialization */ |
mcm | 1:c5b8dc5cdcee | 101 | #define SCD30_CRC8_FINAL_XOR 0x00 /*!< SCD30 CRC-8: Final XOR */ |
mcm | 1:c5b8dc5cdcee | 102 | |
mcm | 1:c5b8dc5cdcee | 103 | |
mcm | 1:c5b8dc5cdcee | 104 | |
mcm | 1:c5b8dc5cdcee | 105 | |
mcm | 1:c5b8dc5cdcee | 106 | |
mcm | 1:c5b8dc5cdcee | 107 | |
mcm | 1:c5b8dc5cdcee | 108 | #ifndef SCD30_VECTOR_STRUCT_H |
mcm | 1:c5b8dc5cdcee | 109 | #define SCD30_VECTOR_STRUCT_H |
mcm | 1:c5b8dc5cdcee | 110 | /* Firmware version */ |
mcm | 1:c5b8dc5cdcee | 111 | typedef struct { |
mcm | 1:c5b8dc5cdcee | 112 | uint8_t version_major; |
mcm | 1:c5b8dc5cdcee | 113 | uint8_t version_minor; |
mcm | 1:c5b8dc5cdcee | 114 | } SCD30_fw_version_t; |
mcm | 1:c5b8dc5cdcee | 115 | |
mcm | 1:c5b8dc5cdcee | 116 | |
mcm | 1:c5b8dc5cdcee | 117 | /* Raw measurement data */ |
mcm | 1:c5b8dc5cdcee | 118 | typedef struct { |
mcm | 1:c5b8dc5cdcee | 119 | uint8_t co2_mmsb; |
mcm | 1:c5b8dc5cdcee | 120 | uint8_t co2_mlsb; |
mcm | 1:c5b8dc5cdcee | 121 | uint8_t co2_mmsb_mlsb_crc; |
mcm | 1:c5b8dc5cdcee | 122 | |
mcm | 1:c5b8dc5cdcee | 123 | uint8_t co2_lmsb; |
mcm | 1:c5b8dc5cdcee | 124 | uint8_t co2_llsb; |
mcm | 1:c5b8dc5cdcee | 125 | uint8_t co2_lmsb_llsb_crc; |
mcm | 1:c5b8dc5cdcee | 126 | |
mcm | 1:c5b8dc5cdcee | 127 | uint8_t temperature_mmsb; |
mcm | 1:c5b8dc5cdcee | 128 | uint8_t temperature_mlsb; |
mcm | 1:c5b8dc5cdcee | 129 | uint8_t temperature_mmsb_mlsb_crc; |
mcm | 1:c5b8dc5cdcee | 130 | |
mcm | 1:c5b8dc5cdcee | 131 | uint8_t temperature_lmsb; |
mcm | 1:c5b8dc5cdcee | 132 | uint8_t temperature_llsb; |
mcm | 1:c5b8dc5cdcee | 133 | uint8_t temperature_lmsb_llsb_crc; |
mcm | 1:c5b8dc5cdcee | 134 | |
mcm | 1:c5b8dc5cdcee | 135 | uint8_t humidity_mmsb; |
mcm | 1:c5b8dc5cdcee | 136 | uint8_t humidity_mlsb; |
mcm | 1:c5b8dc5cdcee | 137 | uint8_t humidity_mmsb_mlsb_crc; |
mcm | 1:c5b8dc5cdcee | 138 | |
mcm | 1:c5b8dc5cdcee | 139 | uint8_t humidity_lmsb; |
mcm | 1:c5b8dc5cdcee | 140 | uint8_t humidity_llsb; |
mcm | 1:c5b8dc5cdcee | 141 | uint8_t humidity_lmsb_llsb_crc; |
mcm | 1:c5b8dc5cdcee | 142 | } SCD30_raw_output_data_t; |
mcm | 1:c5b8dc5cdcee | 143 | |
mcm | 1:c5b8dc5cdcee | 144 | |
mcm | 1:c5b8dc5cdcee | 145 | /* Measurement processed data */ |
mcm | 1:c5b8dc5cdcee | 146 | typedef struct { |
mcm | 1:c5b8dc5cdcee | 147 | float co2; |
mcm | 1:c5b8dc5cdcee | 148 | float temperature; |
mcm | 1:c5b8dc5cdcee | 149 | float humidity; |
mcm | 1:c5b8dc5cdcee | 150 | } SCD30_processed_data_t; |
mcm | 1:c5b8dc5cdcee | 151 | |
mcm | 1:c5b8dc5cdcee | 152 | |
mcm | 1:c5b8dc5cdcee | 153 | /* Measurement data: Raw and processed data */ |
mcm | 1:c5b8dc5cdcee | 154 | typedef struct { |
mcm | 1:c5b8dc5cdcee | 155 | SCD30_raw_output_data_t raw; |
mcm | 1:c5b8dc5cdcee | 156 | SCD30_processed_data_t processed; |
mcm | 1:c5b8dc5cdcee | 157 | } SCD30_output_data_t; |
mcm | 1:c5b8dc5cdcee | 158 | |
mcm | 1:c5b8dc5cdcee | 159 | |
mcm | 1:c5b8dc5cdcee | 160 | |
mcm | 1:c5b8dc5cdcee | 161 | |
mcm | 1:c5b8dc5cdcee | 162 | /* USER: User's variables */ |
mcm | 1:c5b8dc5cdcee | 163 | typedef struct { |
mcm | 1:c5b8dc5cdcee | 164 | /* Output data */ |
mcm | 1:c5b8dc5cdcee | 165 | SCD30_output_data_t data; /*< Data (processed and raw): CO2, Temperature and Humidity */ |
mcm | 1:c5b8dc5cdcee | 166 | |
mcm | 1:c5b8dc5cdcee | 167 | /* Pressure compensation */ |
mcm | 1:c5b8dc5cdcee | 168 | uint16_t pressure_compensation; /*< 0 (desactivates pressure compensation) or [700 - 1400]. Pressure in mBar */ |
mcm | 1:c5b8dc5cdcee | 169 | |
mcm | 1:c5b8dc5cdcee | 170 | /* Set measurement interval */ |
mcm | 1:c5b8dc5cdcee | 171 | uint16_t measurement_interval; /*< [2 - 1800]. Interval in seconds */ |
mcm | 1:c5b8dc5cdcee | 172 | |
mcm | 1:c5b8dc5cdcee | 173 | /* Status */ |
mcm | 1:c5b8dc5cdcee | 174 | SCD30_get_ready_status_bit_t status; /*< Measurement is ready to be read from the sensor */ |
mcm | 1:c5b8dc5cdcee | 175 | |
mcm | 1:c5b8dc5cdcee | 176 | /* (De-)Activate automatic self-calibration */ |
mcm | 1:c5b8dc5cdcee | 177 | SCD30_continuous_auto_selfcal_t asc; /*< Continuos automatic self-calibration */ |
mcm | 1:c5b8dc5cdcee | 178 | |
mcm | 1:c5b8dc5cdcee | 179 | /* Forced recalibration */ |
mcm | 1:c5b8dc5cdcee | 180 | uint16_t frc; /*< Value of C02 concentration in ppm */ |
mcm | 1:c5b8dc5cdcee | 181 | |
mcm | 1:c5b8dc5cdcee | 182 | /* Set temperature offset */ |
mcm | 1:c5b8dc5cdcee | 183 | uint16_t temperature_offset; /*< Value of Temperature offset. [°C x 100]. One tick corresponds to 0.01 C */ |
mcm | 1:c5b8dc5cdcee | 184 | |
mcm | 1:c5b8dc5cdcee | 185 | /* Altitude compensation */ |
mcm | 1:c5b8dc5cdcee | 186 | uint16_t altitude_compensation; /*< Altitude compensation value. Height over sea level in [m] above 0 */ |
mcm | 1:c5b8dc5cdcee | 187 | |
mcm | 1:c5b8dc5cdcee | 188 | /* Firmware version */ |
mcm | 1:c5b8dc5cdcee | 189 | SCD30_fw_version_t firmware; /*< Firmware version */ |
mcm | 1:c5b8dc5cdcee | 190 | } SCD30_data_t; |
mcm | 1:c5b8dc5cdcee | 191 | #endif |
mcm | 1:c5b8dc5cdcee | 192 | |
mcm | 1:c5b8dc5cdcee | 193 | |
mcm | 1:c5b8dc5cdcee | 194 | |
mcm | 1:c5b8dc5cdcee | 195 | |
mcm | 1:c5b8dc5cdcee | 196 | /** |
mcm | 1:c5b8dc5cdcee | 197 | * @brief INTERNAL CONSTANTS |
mcm | 1:c5b8dc5cdcee | 198 | */ |
mcm | 1:c5b8dc5cdcee | 199 | typedef enum { |
mcm | 1:c5b8dc5cdcee | 200 | SCD30_SUCCESS = 0, |
mcm | 1:c5b8dc5cdcee | 201 | SCD30_FAILURE = 1, |
mcm | 1:c5b8dc5cdcee | 202 | SCD30_DATA_CORRUPTED = 2, |
mcm | 1:c5b8dc5cdcee | 203 | I2C_SUCCESS = 0 |
mcm | 1:c5b8dc5cdcee | 204 | } SCD30_status_t; |
mcm | 1:c5b8dc5cdcee | 205 | |
mcm | 1:c5b8dc5cdcee | 206 | |
mcm | 1:c5b8dc5cdcee | 207 | |
mcm | 1:c5b8dc5cdcee | 208 | /** |
mcm | 1:c5b8dc5cdcee | 209 | * @brief FUNCTION PROTOTYPES |
mcm | 1:c5b8dc5cdcee | 210 | */ |
mcm | 1:c5b8dc5cdcee | 211 | /** Create an SCD30 object connected to the specified I2C pins. |
mcm | 1:c5b8dc5cdcee | 212 | * |
mcm | 1:c5b8dc5cdcee | 213 | * @param sda I2C data pin |
mcm | 1:c5b8dc5cdcee | 214 | * @param scl I2C clock pin |
mcm | 1:c5b8dc5cdcee | 215 | * @param addr I2C slave address |
mcm | 1:c5b8dc5cdcee | 216 | * @param freq I2C frequency in Hz. |
mcm | 1:c5b8dc5cdcee | 217 | */ |
mcm | 1:c5b8dc5cdcee | 218 | SCD30 ( PinName sda, PinName scl, uint32_t addr, uint32_t freq ); |
mcm | 1:c5b8dc5cdcee | 219 | |
mcm | 1:c5b8dc5cdcee | 220 | /** Delete SCD30 object. |
mcm | 1:c5b8dc5cdcee | 221 | */ |
mcm | 1:c5b8dc5cdcee | 222 | ~SCD30(); |
mcm | 1:c5b8dc5cdcee | 223 | |
mcm | 1:c5b8dc5cdcee | 224 | /** It configures the I2C peripheral. |
mcm | 1:c5b8dc5cdcee | 225 | */ |
mcm | 1:c5b8dc5cdcee | 226 | SCD30_status_t SCD30_Init ( void ); |
mcm | 1:c5b8dc5cdcee | 227 | |
mcm | 1:c5b8dc5cdcee | 228 | /** It triggers continuous measurement with or without ambient pressure compensation. |
mcm | 1:c5b8dc5cdcee | 229 | */ |
mcm | 1:c5b8dc5cdcee | 230 | SCD30_status_t SCD30_TriggerContinuousMeasurement ( uint16_t pressure_compensation ); |
mcm | 1:c5b8dc5cdcee | 231 | |
mcm | 1:c5b8dc5cdcee | 232 | /** It stops the continuous measurement. |
mcm | 1:c5b8dc5cdcee | 233 | */ |
mcm | 1:c5b8dc5cdcee | 234 | SCD30_status_t SCD30_StopContinuousMeasurement ( void ); |
mcm | 1:c5b8dc5cdcee | 235 | |
mcm | 1:c5b8dc5cdcee | 236 | /** It sets the measurement interval. |
mcm | 1:c5b8dc5cdcee | 237 | */ |
mcm | 1:c5b8dc5cdcee | 238 | SCD30_status_t SCD30_SetMeasurementInterval ( uint16_t measurement_interval ); |
mcm | 1:c5b8dc5cdcee | 239 | |
mcm | 1:c5b8dc5cdcee | 240 | /** It gets the measurement interval. |
mcm | 1:c5b8dc5cdcee | 241 | */ |
mcm | 1:c5b8dc5cdcee | 242 | SCD30_status_t SCD30_GetMeasurementInterval ( uint16_t* measurement_interval ); |
mcm | 1:c5b8dc5cdcee | 243 | |
mcm | 1:c5b8dc5cdcee | 244 | /** It gets the status when the data is ready to be read. |
mcm | 1:c5b8dc5cdcee | 245 | */ |
mcm | 1:c5b8dc5cdcee | 246 | SCD30_status_t SCD30_GetDataReadyStatus ( SCD30_get_ready_status_bit_t* status ); |
mcm | 1:c5b8dc5cdcee | 247 | |
mcm | 1:c5b8dc5cdcee | 248 | /** It gets all the raw data. |
mcm | 1:c5b8dc5cdcee | 249 | */ |
mcm | 1:c5b8dc5cdcee | 250 | SCD30_status_t SCD30_ReadRawMeasurement ( SCD30_raw_output_data_t* raw_data ); |
mcm | 1:c5b8dc5cdcee | 251 | |
mcm | 1:c5b8dc5cdcee | 252 | /** It gets all the data. |
mcm | 1:c5b8dc5cdcee | 253 | */ |
mcm | 1:c5b8dc5cdcee | 254 | SCD30_status_t SCD30_ReadMeasurement ( SCD30_output_data_t* data ); |
mcm | 1:c5b8dc5cdcee | 255 | |
mcm | 1:c5b8dc5cdcee | 256 | /** It enables/disables the continuous automatic self-calibration. |
mcm | 1:c5b8dc5cdcee | 257 | */ |
mcm | 1:c5b8dc5cdcee | 258 | SCD30_status_t SCD30_SetContinuousASC ( SCD30_continuous_auto_selfcal_t asc ); |
mcm | 1:c5b8dc5cdcee | 259 | |
mcm | 1:c5b8dc5cdcee | 260 | /** It gets the continuous automatic self-calibration bit. |
mcm | 1:c5b8dc5cdcee | 261 | */ |
mcm | 1:c5b8dc5cdcee | 262 | SCD30_status_t SCD30_GetContinuousASC ( SCD30_continuous_auto_selfcal_t* asc ); |
mcm | 1:c5b8dc5cdcee | 263 | |
mcm | 1:c5b8dc5cdcee | 264 | /** It sets the forced recalibration value. |
mcm | 1:c5b8dc5cdcee | 265 | */ |
mcm | 1:c5b8dc5cdcee | 266 | SCD30_status_t SCD30_SetForcedRecalibrationValue ( uint16_t frc ); |
mcm | 1:c5b8dc5cdcee | 267 | |
mcm | 1:c5b8dc5cdcee | 268 | /** It gets the forced recalibration value. |
mcm | 1:c5b8dc5cdcee | 269 | */ |
mcm | 1:c5b8dc5cdcee | 270 | SCD30_status_t SCD30_GetForcedRecalibrationValue ( uint16_t* frc ); |
mcm | 1:c5b8dc5cdcee | 271 | |
mcm | 1:c5b8dc5cdcee | 272 | /** It sets the temperature offset value. |
mcm | 1:c5b8dc5cdcee | 273 | */ |
mcm | 1:c5b8dc5cdcee | 274 | SCD30_status_t SCD30_SetTemperatureOffsetValue ( uint16_t temp_offset ); |
mcm | 1:c5b8dc5cdcee | 275 | |
mcm | 1:c5b8dc5cdcee | 276 | /** It gets the temperature offset value. |
mcm | 1:c5b8dc5cdcee | 277 | */ |
mcm | 1:c5b8dc5cdcee | 278 | SCD30_status_t SCD30_GetTemperatureOffsetValue ( uint16_t* temp_offset ); |
mcm | 1:c5b8dc5cdcee | 279 | |
mcm | 1:c5b8dc5cdcee | 280 | /** It sets the altitude compensation value. |
mcm | 1:c5b8dc5cdcee | 281 | */ |
mcm | 1:c5b8dc5cdcee | 282 | SCD30_status_t SCD30_SetAltitudeCompensationValue ( uint16_t alt_comp ); |
mcm | 1:c5b8dc5cdcee | 283 | |
mcm | 1:c5b8dc5cdcee | 284 | /** It gets the altitude compensation value. |
mcm | 1:c5b8dc5cdcee | 285 | */ |
mcm | 1:c5b8dc5cdcee | 286 | SCD30_status_t SCD30_GetAltitudeCompensationValue ( uint16_t* alt_comp ); |
mcm | 1:c5b8dc5cdcee | 287 | |
mcm | 1:c5b8dc5cdcee | 288 | /** It gets the firmware version value. |
mcm | 1:c5b8dc5cdcee | 289 | */ |
mcm | 1:c5b8dc5cdcee | 290 | SCD30_status_t SCD30_GetFirmwareVersion ( SCD30_fw_version_t* fw ); |
mcm | 1:c5b8dc5cdcee | 291 | |
mcm | 1:c5b8dc5cdcee | 292 | /** It performs a software reset. |
mcm | 1:c5b8dc5cdcee | 293 | */ |
mcm | 1:c5b8dc5cdcee | 294 | SCD30_status_t SCD30_SoftReset ( void ); |
mcm | 1:c5b8dc5cdcee | 295 | |
mcm | 2:0d0174b46fd3 | 296 | private: |
mcm | 1:c5b8dc5cdcee | 297 | /** It calculates the I2C checksum calculation (CRC-8). |
mcm | 1:c5b8dc5cdcee | 298 | */ |
mcm | 1:c5b8dc5cdcee | 299 | uint8_t SCD30_CalculateI2C_CRC8 ( uint16_t seed ); |
mcm | 2:0d0174b46fd3 | 300 | |
mcm | 1:c5b8dc5cdcee | 301 | I2C _i2c; |
mcm | 1:c5b8dc5cdcee | 302 | uint32_t _SCD30_Addr; |
mcm | 1:c5b8dc5cdcee | 303 | }; |
mcm | 1:c5b8dc5cdcee | 304 | |
mcm | 1:c5b8dc5cdcee | 305 | #endif /* SCD30_H */ |