environment2 2.0.0.0
|
API for configuring and manipulating Environment 2 Click driver. More...
Topics | |
Environment 2 Registers List | |
List of registers of Environment 2 Click driver. | |
Environment 2 Registers Settings | |
Settings for registers of Environment 2 Click driver. | |
Environment 2 MikroBUS Map | |
MikroBUS pin mapping of Environment 2 Click driver. | |
Environment2_cmd | |
Environment2_get | |
Functions | |
void | environment2_cfg_setup (environment2_cfg_t *cfg) |
Environment 2 configuration object setup function. | |
err_t | environment2_init (environment2_t *ctx, environment2_cfg_t *cfg) |
Environment 2 initialization function. | |
err_t | environment2_generic_write (environment2_t *ctx, uint8_t select_device, uint16_t cmd) |
Environment 2 I2C writing function. | |
err_t | environment2_generic_read (environment2_t *ctx, uint8_t select_device, uint16_t cmd, uint8_t *rx_buf) |
Environment 2 I2C reading function. | |
err_t | environment2_get_temp_hum (environment2_t *ctx, float *humidity, float *temperature) |
Environment 2 get temperature and relative humidity function. | |
err_t | environment2_get_air_quality (environment2_t *ctx, uint16_t *air_quality) |
Environment 2 get air quality data function. | |
uint16_t | environment2_sgp40_measure_test (environment2_t *ctx) |
Environment 2 SGP40 measurement test function. | |
err_t | environment2_sgp40_heater_off (environment2_t *ctx) |
Environment 2 heater off function. | |
err_t | environment2_sgp40_soft_reset (environment2_t *ctx) |
Environment 2 soft reset function. | |
err_t | environment2_voc_algorithm_configuration (environment2_voc_algorithm_params *params) |
Environment 2 VOC algorithm configuration function. | |
err_t | environment2_config_sensors (void) |
Environment 2 sensors configuration function. | |
err_t | environment2_voc_algorithm_process (environment2_voc_algorithm_params *params, int32_t sraw, int32_t *voc_index) |
Environment 2 VOC algorithm process function. | |
err_t | environment2_measure_voc_index_with_rh_t (environment2_t *ctx, int32_t *voc_index, int32_t *relative_humidity, int32_t *temperature) |
Environment 2 measure VOC index with relative humidity and temperature function. | |
err_t | environment2_get_voc_index (environment2_t *ctx, int32_t *voc_index) |
Environment 2 get VOC index function. | |
API for configuring and manipulating Environment 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void environment2_cfg_setup | ( | environment2_cfg_t * | cfg | ) |
Environment 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See environment2_cfg_t object definition for detailed explanation. |
err_t environment2_config_sensors | ( | void | ) |
Environment 2 sensors configuration function.
This function general performs sensors configuration and initialize VOC algorithm of the SGP40 Indoor Air Quality Sensor for VOC Measurements.
0
- Success, -1
- Error.err_t environment2_generic_read | ( | environment2_t * | ctx, |
uint8_t | select_device, | ||
uint16_t | cmd, | ||
uint8_t * | rx_buf ) |
Environment 2 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[in] | select_device | : Device selection. |
[in] | cmd | : Command to be written. |
[out] | rx_buf | : Output read data. |
0
- Success, -1
- Error.err_t environment2_generic_write | ( | environment2_t * | ctx, |
uint8_t | select_device, | ||
uint16_t | cmd ) |
Environment 2 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[in] | select_device | : Device selection. |
[in] | cmd | : Command to be written. |
0
- Success, -1
- Error.err_t environment2_get_air_quality | ( | environment2_t * | ctx, |
uint16_t * | air_quality ) |
Environment 2 get air quality data function.
This function reads a air quality SRAW data from the SGP40 Indoor Air Quality Sensor for VOC Measurements by using I2C serial interface.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[out] | air_quality | : Air quality SRAW data. |
0
- Success, -1
- Error.err_t environment2_get_temp_hum | ( | environment2_t * | ctx, |
float * | humidity, | ||
float * | temperature ) |
Environment 2 get temperature and relative humidity function.
This function reads a temperature and relative humidity from the SHT40 4th Generation, High-Accuracy, Ultra-Low-Power, 16-bit Relative Humidity and Temperature Sensor Platform by using I2C serial interface.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[out] | humidity | : Relative Humidity [ RH ]. |
[out] | temperature | : Temperature [ degree Celsius ]. |
0
- Success, -1
- Error.err_t environment2_get_voc_index | ( | environment2_t * | ctx, |
int32_t * | voc_index ) |
Environment 2 get VOC index function.
This function measurement triggers a humidity reading, sets the value on the SGP for humidity compensation and runs the gas signal through the VOC algorithm for the final result.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[out] | voc_index | : Pointer to buffer for measured VOC index. Range 0..500. |
0
- Success, -1
- Error.err_t environment2_init | ( | environment2_t * | ctx, |
environment2_cfg_t * | cfg ) |
Environment 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See environment2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t environment2_measure_voc_index_with_rh_t | ( | environment2_t * | ctx, |
int32_t * | voc_index, | ||
int32_t * | relative_humidity, | ||
int32_t * | temperature ) |
Environment 2 measure VOC index with relative humidity and temperature function.
This function measure the humidity-compensated VOC Index,
ambient temperature and relative humidity.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[out] | voc_index | : Pointer to buffer for measured VOC index. Range 0..500. |
[out] | relative_humidity | : Relative Humidity [ milli RH ]. |
[out] | temperature | : Temperature [ milli degree Celsius ]. |
0
- Success, -1
- Error.err_t environment2_sgp40_heater_off | ( | environment2_t * | ctx | ) |
Environment 2 heater off function.
This function turns the hotplate off and stops the measurement of the SGP40 Indoor Air Quality Sensor for VOC Measurements by using I2C serial interface.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint16_t environment2_sgp40_measure_test | ( | environment2_t * | ctx | ) |
Environment 2 SGP40 measurement test function.
This function triggers the built-in self-test checking for integrity of both hotplate and MOX materia of the SGP40 Indoor Air Quality Sensor for VOC Measurements by using I2C serial interface.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
0xD400
( ENVIRONMENT2_SGP40_TEST_PASSED ) - All tests passed successfully, 0x4B00
( ENVIRONMENT2_SGP40_TEST_FAILED ) - One or more tests have failed.err_t environment2_sgp40_soft_reset | ( | environment2_t * | ctx | ) |
Environment 2 soft reset function.
This function general call resetting all devices connected to the same I2C bus of the SGP40 Indoor Air Quality Sensor for VOC Measurements.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t environment2_voc_algorithm_configuration | ( | environment2_voc_algorithm_params * | params | ) |
Environment 2 VOC algorithm configuration function.
This function initialize VOC algorithm.
[in] | environment2_voc_algorithm_params | : Struct to hold all the states of the VOC algorithm. |
0
- Success, -1
- Error.err_t environment2_voc_algorithm_process | ( | environment2_voc_algorithm_params * | params, |
int32_t | sraw, | ||
int32_t * | voc_index ) |
Environment 2 VOC algorithm process function.
This function calculate the VOC index value from the raw sensor value.
[in] | ctx | : Click context object. See environment2_t object definition for detailed explanation. |
[in] | params | : Pointer to the environment2_voc_algorithm_params struct. |
[in] | sraw | : Air quality SRAW data. |
[out] | voc_index | : Calculated VOC index value from the raw sensor value. Zero during initial blackout period and 1..500 afterwards. |
0
- Success, -1
- Error.