39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
79#define HVAC_START_PERIODIC_MEASUREMENT 0x21B1
80#define HVAC_START_LOW_POWER_PERIODIC_MEASUREMENT 0x21AC
81#define HVAC_START_ULTRA_LOW_POWER_PERIODIC_MEASUREMENT 0x21A7
82#define HVAC_MEASURE_SINGLE_SHOT 0x219D
83#define HVAC_MEASURE_SINGLE_SHOT_RHT_ONLY 0x2196
84#define HVAC_READ_MEASUREMENT 0xEC05
85#define HVAC_STOP_PERIODIC_MEASUREMENT 0x3F86
86#define HVAC_GET_SERIAL_NUMBER 0x3682
87#define HVAC_GET_FEATURE_SET_VERSION 0x202F
88#define HVAC_GET_TEMPERATURE_OFFSET 0x2318
89#define HVAC_SET_TEMPERATURE_OFFSET 0x241D
90#define HVAC_PERFORM_FORCED_RECALIBRATION 0x362F
91#define HVAC_GET_AUTOMATIC_SELF_CALIBRATION_ENABLED 0x2313
92#define HVAC_SET_AUTOMATIC_SELF_CALIBRATION_ENABLED 0x2416
93#define HVAC_GET_AUTOMATIC_SELF_CALIBRATION_INITIAL_PERIOD 0x2340
94#define HVAC_SET_AUTOMATIC_SELF_CALIBRATION_INITIAL_PERIOD 0x2445
95#define HVAC_GET_AUTOMATIC_SELF_CALIBRATION_STANDARD_PERIOD 0x234B
96#define HVAC_SET_AUTOMATIC_SELF_CALIBRATION_STANDARD_PERIOD 0x244E
97#define HVAC_PERSIST_SETTINGS 0x3615
98#define HVAC_PERFORM_FACTORY_RESET 0x3632
99#define HVAC_REINIT 0x3646
105#define HVAC_SPS30_I2C_START_MEASUREMENT 0x0010
106#define HVAC_SPS30_I2C_STOP_MEASUREMENT 0x0104
107#define HVAC_SPS30_I2C_READ_DATA_RDY_FLAG 0x0202
108#define HVAC_SPS30_I2C_READ_MEASURED_VALUE 0x0300
109#define HVAC_SPS30_I2C_SLEEP 0x1001
110#define HVAC_SPS30_I2C_WAKEUP 0x1103
111#define HVAC_SPS30_I2C_START_FAN_CLEANING 0x5607
112#define HVAC_SPS30_I2C_AUTO_CLEANING_INTERVAL 0x8004
113#define HVAC_SPS30_I2C_SET_AUTO_CLEANING_INTERVAL 0x8005
114#define HVAC_SPS30_I2C_STOP_MEASUREMENT_DUMMY 0x0000
116#define HVAC_SPS30_I2C_READ_PRODUCT_TYPE 0xD002
117#define HVAC_SPS30_I2C_READ_SERIAL_NUMBER 0xD033
118#define HVAC_SPS30_I2C_READ_VERSION 0xD100
119#define HVAC_SPS30_I2C_READ_STATUS_REGISTER 0xD206
120#define HVAC_SPS30_I2C_CLEAR_STATUS_REGISTER 0xD210
121#define HVAC_SPS30_I2C_RESET 0xD304
127#define HVAC_SPS30_NEW_DATA_NOT_READY 0x00
128#define HVAC_SPS30_NEW_DATA_IS_READY 0x01
135#define HVAC_SPS30_SLAVE_ADDR 0x69
136#define HVAC_SCD40_SLAVE_ADDR 0x62
155#define HVAC_MAP_MIKROBUS( cfg, mikrobus ) \
156 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
157 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
err_t hvac_sps30_i2c_read_data(hvac_t *ctx, uint16_t reg, uint16_t *rx_data)
SPS30 generic read data function.
err_t hvac_generic_write(hvac_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
HVAC I2C writing function.
void hvac_sps30_read_measured_data(hvac_t *ctx, mass_and_num_cnt_data_t *m_n_c_data)
SPS30 read measured data function.
uint8_t hvac_sps30_get_ready_flag(hvac_t *ctx)
SPS30 get ready flag function.
void hvac_sps30_device_reset(hvac_t *ctx)
SPS30 set device reset function.
err_t hvac_init(hvac_t *ctx, hvac_cfg_t *cfg)
HVAC initialization function.
void hvac_scd40_get_feature_set_version(hvac_t *ctx, feature_data_t *f_data)
SCD40 get feature set version function.
void hvac_scd40_read_measurement(hvac_t *ctx, measuremen_data_t *m_data)
SCD40 read measurement function.
float hvac_scd40_get_temperature_offset(hvac_t *ctx)
SCD40 get temperature offset function.
void hvac_scd40_get_serial_number(hvac_t *ctx, uint16_t *serial_number)
SCD40 get serial number function.
err_t hvac_scd40_write_data(hvac_t *ctx, uint16_t reg, uint16_t tx_data)
SCD40 generic write data function.
void hvac_scd40_send_cmd(hvac_t *ctx, uint16_t cmd)
SCD40 send command function.
err_t hvac_generic_read(hvac_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
HVAC I2C reading function.
err_t hvac_scd40_read_data(hvac_t *ctx, uint16_t reg, uint16_t *rx_data)
SCD40 generic read data function.
err_t hvac_sps30_i2c_write_data(hvac_t *ctx, uint16_t reg, uint16_t tx_data)
SPS30 generic write data function.
void hvac_sps30_start_measurement(hvac_t *ctx)
SPS30 start measurement command function.
void hvac_sps30_stop_measurement(hvac_t *ctx)
SPS30 stop measurement command function.
void hvac_cfg_setup(hvac_cfg_t *cfg)
HVAC configuration object setup function.
void hvac_scd40_set_temperature_offset(hvac_t *ctx, float temp_offset)
SCD40 set temperature offset function.
hvac_return_value_t
HVAC Click return value data.
Definition hvac.h:239
@ HVAC_ERROR
Definition hvac.h:241
@ HVAC_OK
Definition hvac.h:240
HVAC Click feature data object.
Definition hvac.h:180
uint8_t product_minor_version
Definition hvac.h:184
uint8_t product_major_version
Definition hvac.h:183
uint8_t product_type
Definition hvac.h:181
uint8_t platform_type
Definition hvac.h:182
HVAC Click configuration object.
Definition hvac.h:225
uint32_t i2c_speed
Definition hvac.h:229
pin_name_t scl
Definition hvac.h:226
pin_name_t sda
Definition hvac.h:227
uint8_t i2c_address
Definition hvac.h:230
HVAC Click context object.
Definition hvac.h:210
uart_t uart
Definition hvac.h:213
i2c_master_t i2c
Definition hvac.h:212
uint8_t slave_address
Definition hvac.h:216
HVAC Click mass and number of particles object.
Definition hvac.h:192
float num_pm_10
Definition hvac.h:201
float num_pm_1_0
Definition hvac.h:198
float mass_pm_10
Definition hvac.h:196
float num_pm_4_0
Definition hvac.h:200
float mass_pm_4_0
Definition hvac.h:195
float mass_pm_2_5
Definition hvac.h:194
float num_pm_2_5
Definition hvac.h:199
float mass_pm_1_0
Definition hvac.h:193
float typ_ptcl_size
Definition hvac.h:202
float num_pm_0_5
Definition hvac.h:197
HVAC Click measurements object.
Definition hvac.h:167
uint16_t co2_concent
Definition hvac.h:168
uint16_t asc_last_correction
Definition hvac.h:172
uint16_t asc_update_count
Definition hvac.h:171
float r_humidity
Definition hvac.h:170
float temperature
Definition hvac.h:169