Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define CO2_REG_DISABLE_CRC 0x3768
70 #define CO2_REG_SET_BINARY_GAS 0x3615
71 #define CO2_REG_SET_RELATIVE_HUMIDITY 0x3624
72 #define CO2_REG_SET_TEMPERATURE 0x361E
73 #define CO2_REG_SET_PRESSURE 0x362F
74 #define CO2_REG_MEASURE_GAS_CONCENTRATION 0x3639
75 #define CO2_REG_FORCED_RECALIBRATION 0x3661
76 #define CO2_REG_ENABLE_AUTO_SELF_CALIB 0x3FEF
77 #define CO2_REG_DISABLE_AUTO_SELF_CALIB 0x3F6E
78 #define CO2_REG_PREPARE_READ_STATE 0x3752
79 #define CO2_REG_READ_STATE 0xE133
80 #define CO2_REG_WRITE_STATE 0xE133
81 #define CO2_REG_APPLY_STATE 0x3650
82 #define CO2_REG_SELF_TEST 0x365B
83 #define CO2_REG_RESET 0x0006
84 #define CO2_REG_ENTER_SLEEP_MODE 0x3677
102 #define CO2_SET_BINARY_GAS_IN_N2_100PCT 0x0000
103 #define CO2_SET_BINARY_GAS_IN_AIR_100PCT 0x0001
104 #define CO2_SET_BINARY_GAS_IN_N2_25PCT 0x0002
105 #define CO2_SET_BINARY_GAS_IN_AIR_25PCT 0x0003
107 #define CO2_DEVICE_ID 0x08010301
114 #define CO2_SET_DEV_ADDR_GND 0x29
115 #define CO2_SET_DEV_ADDR_1KOHMS 0x2C
116 #define CO2_SET_DEV_ADDR_3p3KOHMS 0x2B
117 #define CO2_SET_DEV_ADDR_10KOHMS 0x2A
135 #define CO2_MAP_MIKROBUS( cfg, mikrobus ) \
136 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
137 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
156 uint32_t serial_id[ 2 ];
err_t co2_generic_write(co2_t *ctx, uint16_t reg, uint16_t *tx_buf, uint8_t tx_len)
CO2 I2C writing function.
err_t co2_reset(co2_t *ctx)
Reset device.
pin_name_t scl
Definition: co2.h:167
err_t co2_get_id(co2_t *ctx)
Read device and serial ID's.
uint32_t i2c_speed
Definition: co2.h:170
uint8_t crc_enabled
Definition: co2.h:157
@ CO2_ERROR
Definition: co2.h:182
co2_return_value_t
CO2 Click return value data.
Definition: co2.h:180
pin_name_t sda
Definition: co2.h:168
@ CO2_ERROR_CRC
Definition: co2.h:184
@ CO2_OK
Definition: co2.h:181
err_t co2_default_cfg(co2_t *ctx)
CO2 default configuration function.
uint8_t i2c_address
Definition: co2.h:171
@ CO2_ERROR_SELF_TEST
Definition: co2.h:183
err_t co2_set_reference(co2_t *ctx, uint16_t humidity, uint16_t pressure)
Set device refrence values for gas calculation.
uint8_t slave_address
Definition: co2.h:152
CO2 Click context object.
Definition: co2.h:147
uint32_t device_id
Definition: co2.h:155
void co2_cfg_setup(co2_cfg_t *cfg)
CO2 configuration object setup function.
i2c_master_t i2c
Definition: co2.h:149
err_t co2_disable_crc(co2_t *ctx)
Disable use of CRC.
err_t co2_init(co2_t *ctx, co2_cfg_t *cfg)
CO2 initialization function.
err_t co2_generic_read(co2_t *ctx, uint16_t reg, uint16_t *rx_buf, uint8_t rx_len)
CO2 I2C reading function.
err_t co2_read_gas(co2_t *ctx, float *gas_concentration, float *temperature)
Read CO2 concentration and temperature value.
CO2 Click configuration object.
Definition: co2.h:166