Go to the documentation of this file.
38 #include "mikrosdk_version.h"
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
62 #define NO2_MAP_MIKROBUS( cfg, mikrobus ) \
63 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
64 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
65 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
66 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
73 #define NO2_RETVAL uint8_t
76 #define NO2_INIT_ERROR 0xFF
83 #define NO2_STATUS_REG 0x00
84 #define NO2_LOCK_REG 0x01
85 #define NO2_TIACN_REG 0x10
86 #define NO2_REFCN_REG 0x11
87 #define NO2_MODECN_REG 0x12
94 #define NO2_WRITE_MODE 0x00
95 #define NO2_READ_ONLY_MODE 0x01
102 #define NO2_EXT_TIA_RES 0x00
103 #define NO2_2750_OHM_TIA_RES 0x04
104 #define NO2_3500_OHM_TIA_RES 0x08
105 #define NO2_7K_OHM_TIA_RES 0x0C
106 #define NO2_14K_OHM_TIA_RES 0x10
107 #define NO2_35K_OHM_TIA_RES 0x14
108 #define NO2_120K_OHM_TIA_RES 0x18
109 #define NO2_350K_OHM_TIA_RES 0x1C
110 #define NO2_10_OHM_LOAD_RES 0x00
111 #define NO2_33_OHM_LOAD_RES 0x01
112 #define NO2_50_OHM_LOAD_RES 0x02
113 #define NO2_100_OHM_LOAD_RES 0x03
120 #define NO2_VREF_INT 0x00
121 #define NO2_VREF_EXT 0x80
122 #define NO2_20_PERCENTS_INT_ZERO 0x00
123 #define NO2_50_PERCENTS_INT_ZERO 0x20
124 #define NO2_67_PERCENTS_INT_ZERO 0x40
125 #define NO2_INT_ZERO_BYPASSED 0x60
126 #define NO2_BIAS_POL_NEGATIVE 0x00
127 #define NO2_BIAS_POL_POSITIVE 0x10
128 #define NO2_0_PERCENTS_BIAS 0x00
129 #define NO2_1_PERCENT_BIAS 0x01
130 #define NO2_2_PERCENTS_BIAS 0x02
131 #define NO2_4_PERCENTS_BIAS 0x03
132 #define NO2_6_PERCENTS_BIAS 0x04
133 #define NO2_8_PERCENTS_BIAS 0x05
134 #define NO2_10_PERCENTS_BIAS 0x06
135 #define NO2_12_PERCENTS_BIAS 0x07
136 #define NO2_14_PERCENTS_BIAS 0x08
137 #define NO2_16_PERCENTS_BIAS 0x09
138 #define NO2_18_PERCENTS_BIAS 0x0A
139 #define NO2_20_PERCENTS_BIAS 0x0B
140 #define NO2_22_PERCENTS_BIAS 0x0C
141 #define NO2_24_PERCENTS_BIAS 0x0D
148 #define NO2_FET_DIS 0x00
149 #define NO2_FET_EN 0x80
150 #define NO2_DEEP_SLEEP_MODE 0x00
151 #define NO2_2_LEAD_MODE 0x01
152 #define NO2_STANDBY_MODE 0x02
153 #define NO2_3_LEAD_MODE 0x03
154 #define NO2_TEMP_MODE_TIA_OFF 0x06
155 #define NO2_TEMP_MODE_TIA_ON 0x07
162 #define NO2_DEVICE_EN 0x00
163 #define NO2_DEVICE_DIS 0x01
170 #define ADC_DEVICE_ADDR 0x4D
uint8_t no2_read_byte(no2_t *ctx, uint8_t reg)
Function reads one byte from the register.
pin_name_t scl
Definition: no2.h:210
void no2_enable(no2_t *ctx, uint8_t state)
Device Enable function.
uint32_t i2c_speed
Definition: no2.h:220
void no2_generic_read(no2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void no2_default_cfg(no2_t *ctx)
Click Default Configuration function.
pin_name_t rst
Definition: no2.h:216
uint16_t no2_read_adc(no2_t *ctx)
Function for read ADC sensor data.
digital_out_t rst
Definition: no2.h:187
pin_name_t sda
Definition: no2.h:211
NO2_RETVAL no2_init(no2_t *ctx, no2_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition: no2.h:207
void no2_cfg_setup(no2_cfg_t *cfg)
Config Object Initialization function.
i2c_master_t i2c
Definition: no2.h:195
void no2_wait_ready(no2_t *ctx)
Function waits until I2C is ready for the next command.
uint8_t i2c_address
Definition: no2.h:221
#define NO2_RETVAL
Definition: no2.h:73
void no2_write_byte(no2_t *ctx, uint8_t reg, uint8_t dev_data)
Function writes one byte to the register.
uint8_t slave_address
Definition: no2.h:199
float no2_get_no_2_ppm(no2_t *ctx)
Get NO2 Data function.
Click ctx object definition.
Definition: no2.h:184
digital_in_t an
Definition: no2.h:191
pin_name_t an
Definition: no2.h:215
void no2_generic_write(no2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.