environment4 2.1.0.0
|
API for configuring and manipulating Environment 4 Click driver. More...
Topics | |
Environment 4 Registers List | |
List of registers of Environment 4 Click driver. | |
Environment 4 Registers Settings | |
Settings for registers of Environment 4 Click driver. | |
Environment 4 MikroBUS Map | |
MikroBUS pin mapping of Environment 4 Click driver. | |
Functions | |
void | environment4_cfg_setup (environment4_cfg_t *cfg) |
Environment 4 configuration object setup function. | |
err_t | environment4_init (environment4_t *ctx, environment4_cfg_t *cfg) |
Environment 4 initialization function. | |
err_t | environment4_sgp_exe_conditioning (environment4_t *ctx, uint16_t comp_rh, uint16_t comp_t, uint16_t *sraw_voc) |
Environment 4 sgp exe conditioning function. | |
err_t | environment4_sgp_meas_raw_signals (environment4_t *ctx, uint16_t comp_rh, uint16_t comp_t, uint16_t *sraw_voc, uint16_t *sraw_nox) |
Environment 4 sgp meas raw signals function. | |
err_t | environment4_sgp_exe_self_test (environment4_t *ctx, uint8_t *test_result) |
Environment 4 sgp exe self test function. | |
err_t | environment4_sgp_turn_heater_off (environment4_t *ctx) |
Environment 4 sgp turn heater off function. | |
err_t | environment4_sgp_get_serial_num (environment4_t *ctx, uint16_t *serial_num) |
Environment 4 sgp get serial num function. | |
err_t | environment4_sht_send_cmd (environment4_t *ctx, uint8_t cmd) |
Environment 4 sht send cmd function. | |
err_t | environment4_sht_read_response (environment4_t *ctx, uint8_t *data_out) |
Environment 4 sht read response function. | |
err_t | environment4_sht_soft_reset (environment4_t *ctx) |
Environment 4 sht soft reset function. | |
err_t | environment4_sht_read_serial_num (environment4_t *ctx, uint32_t *serial_num) |
Environment 4 sht read serial num function. | |
err_t | environment4_sht_read_meas_hp (environment4_t *ctx, float *temp, float *hum) |
Environment 4 sht read meas hp function. | |
API for configuring and manipulating Environment 4 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void environment4_cfg_setup | ( | environment4_cfg_t * | cfg | ) |
Environment 4 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See environment4_cfg_t object definition for detailed explanation. |
err_t environment4_init | ( | environment4_t * | ctx, |
environment4_cfg_t * | cfg ) |
Environment 4 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See environment4_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sgp_exe_conditioning | ( | environment4_t * | ctx, |
uint16_t | comp_rh, | ||
uint16_t | comp_t, | ||
uint16_t * | sraw_voc ) |
Environment 4 sgp exe conditioning function.
This function executes conditioning command for SGP41 device by using I2C serial interface. It starts the conditioning, i.e., the VOC pixel will be operated at the same temperature as it is by calling the environment4_sgp_meas_raw_signals function while the NOx pixel will be operated at a different temperature for conditioning. This command returns only the measured raw signal of the VOC pixel SRAW_VOC as 2 bytes.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[in] | comp_rh | : Leaves humidity compensation disabled by sending the default value 0x8000 (50RH) or enabled humidity compensation when sending the relative humidity in ticks (ticks = RH * 65535 / 100) |
[in] | comp_t | : Leaves humidity compensation disabled by sending the default value 0x6666 (25 degC) or enabled humidity compensation when sending the temperature in ticks (ticks = (degC + 45) * 65535 / 175) |
[out] | sraw_voc | : u16 unsigned integer directly provides the raw signal SRAW_VOC in ticks which is proportional to the logarithm of the resistance of the sensing element. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sgp_exe_self_test | ( | environment4_t * | ctx, |
uint8_t * | test_result ) |
Environment 4 sgp exe self test function.
This function triggers the SGP41 device built-in self-test checking for integrity of both hotplate and MOX material and returns the result of this test as 1 byte (only 2 least significant bits are valid).
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[out] | test_result | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sgp_get_serial_num | ( | environment4_t * | ctx, |
uint16_t * | serial_num ) |
Environment 4 sgp get serial num function.
This function provides the decimal serial number of the SGP41 chip by returning 3x2 bytes.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[out] | serial_num | : 48-bit unique serial number. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sgp_meas_raw_signals | ( | environment4_t * | ctx, |
uint16_t | comp_rh, | ||
uint16_t | comp_t, | ||
uint16_t * | sraw_voc, | ||
uint16_t * | sraw_nox ) |
Environment 4 sgp meas raw signals function.
This function measures raw signals for SGP41 device by using I2C serial interface. It starts/continues the VOC + NOx measurement mode.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[in] | comp_rh | : Leaves humidity compensation disabled by sending the default value 0x8000 (50RH) or enabled humidity compensation when sending the relative humidity in ticks (ticks = RH * 65535 / 100) |
[in] | comp_t | : Leaves humidity compensation disabled by sending the default value 0x6666 (25 degC) or enabled humidity compensation when sending the temperature in ticks (ticks = (degC + 45) * 65535 / 175) |
[out] | sraw_voc | : u16 unsigned integer directly provides the raw signal SRAW_VOC in ticks which is proportional to the logarithm of the resistance of the sensing element. |
[out] | sraw_nox | : u16 unsigned integer directly provides the raw signal SRAW_NOX in ticks which is proportional to the logarithm of the resistance of the sensing element. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sgp_turn_heater_off | ( | environment4_t * | ctx | ) |
Environment 4 sgp turn heater off function.
This function turns the hotplate off and stops the measurement for the SGP41 device. Subsequently, the sensor enters the idle mode.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sht_read_meas_hp | ( | environment4_t * | ctx, |
float * | temp, | ||
float * | hum ) |
Environment 4 sht read meas hp function.
This function reads the temperature and humidity measurements with high precision from SHT41A device.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[out] | temp | : Temperature in degrees Celsius. |
[out] | hum | : Relative humidity in percents. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sht_read_response | ( | environment4_t * | ctx, |
uint8_t * | data_out ) |
Environment 4 sht read response function.
This function reads 6 response bytes from SHT41A device to the previously sent command by using I2C serial interface.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[out] | data_out | : 6 response bytes. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sht_read_serial_num | ( | environment4_t * | ctx, |
uint32_t * | serial_num ) |
Environment 4 sht read serial num function.
This function reads the 4-bytes unique serial number from SHT41A device by using I2C serial interface.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[out] | serial_num | : 4-bytes unique serial number. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sht_send_cmd | ( | environment4_t * | ctx, |
uint8_t | cmd ) |
Environment 4 sht send cmd function.
This function sends the selected command byte to SHT41A device by using I2C serial interface.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
[in] | cmd | : Command byte to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t environment4_sht_soft_reset | ( | environment4_t * | ctx | ) |
Environment 4 sht soft reset function.
This function performs the software reset by sending the soft reset command to SHT41A device.
[in] | ctx | : Click context object. See environment4_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.