environment3 2.0.0.0
|
API for configuring and manipulating Environment 3 Click driver. More...
Topics | |
Environment 3 Registers List | |
List of registers of Environment 3 Click driver. | |
Environment 3 Registers Settings | |
Settings for registers of Environment 3 Click driver. | |
Environment 3 MikroBUS Map | |
MikroBUS pin mapping of Environment 3 Click driver. | |
Functions | |
void | environment3_cfg_setup (environment3_cfg_t *cfg) |
Environment 3 configuration object setup function. | |
void | environment3_drv_interface_selection (environment3_cfg_t *cfg, environment3_drv_t drv_sel) |
Environment 3 driver interface setup function. | |
err_t | environment3_init (environment3_t *ctx, environment3_cfg_t *cfg) |
Environment 3 initialization function. | |
err_t | environment3_default_cfg (environment3_t *ctx) |
Environment 3 default configuration function. | |
err_t | environment3_generic_write (environment3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Environment 3 data writing function. | |
err_t | environment3_generic_read (environment3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Environment 3 data reading function. | |
err_t | environment3_write_byte (environment3_t *ctx, uint8_t reg, uint8_t data_in) |
Environment 3 single data writing function. | |
uint8_t | environment3_read_byte (environment3_t *ctx, uint8_t reg) |
Environment 3 single data reading function. | |
int8_t | environment3_check_id (environment3_t *ctx) |
Environment 3 check device ID function. | |
uint8_t | environment3_get_device_id (environment3_t *ctx) |
Environment 3 get device ID function. | |
int8_t | environment3_soft_reset (environment3_t *ctx) |
Environment 3 soft reset function. | |
int8_t | environment3_get_all_data (environment3_t *ctx, float *temp, float *hum, float *pres, uint32_t *gas) |
Environment 3 get all data function. | |
float | environment3_get_temperature (environment3_t *ctx) |
Environment 3 get temperature data function. | |
float | environment3_get_humidity (environment3_t *ctx) |
Environment 3 get humidity data function. | |
float | environment3_get_pressure (environment3_t *ctx) |
Environment 3 get pressure data function. | |
float | environment3_get_gas_resistance (environment3_t *ctx) |
Environment 3 get gas resistance data function. | |
int8_t | environment3_get_regs (environment3_t *ctx, uint8_t reg, uint8_t *data_out, uint16_t len) |
Environment 3 read data from register address function. | |
int8_t | environment3_set_regs (environment3_t *ctx, uint8_t *reg, uint8_t *data_in, uint8_t len) |
Environment 3 write data to registers function. | |
int8_t | environment3_enable_heater (environment3_t *ctx, uint8_t state) |
Environment 3 enable heater function. | |
int8_t | environment3_set_heater_conf (environment3_t *ctx, environment3_gas_settings_t *conf) |
Environment 3 set heater configuration function. | |
int8_t | environment3_set_sensor_conf (environment3_t *ctx, environment3_tph_settings_t *conf) |
Environment 3 set sensor configuration function. | |
int8_t | environment3_set_operating_mode (environment3_t *ctx, uint8_t op_mode) |
Environment 3 set operating mode function. | |
int8_t | environment3_get_operating_mode (environment3_t *ctx) |
Environment 3 get operating mode function. | |
API for configuring and manipulating Environment 3 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void environment3_cfg_setup | ( | environment3_cfg_t * | cfg | ) |
Environment 3 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See environment3_cfg_t object definition for detailed explanation. |
int8_t environment3_check_id | ( | environment3_t * | ctx | ) |
Environment 3 check device ID function.
This function checks the device ID.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
0
- ID correct, -1
- Wrong ID read. err_t environment3_default_cfg | ( | environment3_t * | ctx | ) |
Environment 3 default configuration function.
This function executes a default configuration of Environment 3 click board.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
0
- Success, -1
- Error.void environment3_drv_interface_selection | ( | environment3_cfg_t * | cfg, |
environment3_drv_t | drv_sel ) |
Environment 3 driver interface setup function.
This function sets a serial driver interface which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See environment3_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See environment3_drv_t object definition for detailed explanation. |
int8_t environment3_enable_heater | ( | environment3_t * | ctx, |
uint8_t | state ) |
Environment 3 enable heater function.
This function enables or disables the gas sensor heater.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | state | : 1 - Enable, 0 - Disable. |
0
- Success, -1
- Error. -2
- Communication fail. err_t environment3_generic_read | ( | environment3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Environment 3 data reading function.
This function reads a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t environment3_generic_write | ( | environment3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Environment 3 data writing function.
This function writes a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.int8_t environment3_get_all_data | ( | environment3_t * | ctx, |
float * | temp, | ||
float * | hum, | ||
float * | pres, | ||
uint32_t * | gas ) |
Environment 3 get all data function.
This function reads the temperature, humidity, pressure, and gas resistance data from the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[out] | temp | : Temperature value in Celsius. |
[out] | hum | : Temperature value in Percents. |
[out] | pres | : Pressure value in mBar. |
[out] | gas | : Gas resistance value in Ohms. |
2
- No new data. 0
- Success, -1
- Error. uint8_t environment3_get_device_id | ( | environment3_t * | ctx | ) |
Environment 3 get device ID function.
This function gets the device ID.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
float environment3_get_gas_resistance | ( | environment3_t * | ctx | ) |
Environment 3 get gas resistance data function.
This function reads the gas resistance from the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
2.0
- No new data. -1.0
- Error. float environment3_get_humidity | ( | environment3_t * | ctx | ) |
Environment 3 get humidity data function.
This function reads the humidity from the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
2.0
- No new data. -1.0
- Error. int8_t environment3_get_operating_mode | ( | environment3_t * | ctx | ) |
Environment 3 get operating mode function.
This function gets the operating mode of the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | op_mode | : 0 - SLEEP, 1 - FORCED. |
-1
- Error. float environment3_get_pressure | ( | environment3_t * | ctx | ) |
Environment 3 get pressure data function.
This function reads the pressure from the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
2.0
- No new data. -1.0
- Error. int8_t environment3_get_regs | ( | environment3_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint16_t | len ) |
Environment 3 read data from register address function.
This function reads the desired number of data bytes starting from the given register address of sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error. -2
- Communication fail. float environment3_get_temperature | ( | environment3_t * | ctx | ) |
Environment 3 get temperature data function.
This function reads the temperature from the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
2.0
- No new data. -1.0
- Error. err_t environment3_init | ( | environment3_t * | ctx, |
environment3_cfg_t * | cfg ) |
Environment 3 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See environment3_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t environment3_read_byte | ( | environment3_t * | ctx, |
uint8_t | reg ) |
Environment 3 single data reading function.
This function reads a single data byte from the selected register.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
int8_t environment3_set_heater_conf | ( | environment3_t * | ctx, |
environment3_gas_settings_t * | conf ) |
Environment 3 set heater configuration function.
This function sets the gas configuration of the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | conf | : Gas setting object. See environment3_gas_settings_t gas setting object definition for detailed explanation. |
0
- Success, -1
- Error. -2
- Communication fail. int8_t environment3_set_operating_mode | ( | environment3_t * | ctx, |
uint8_t | op_mode ) |
Environment 3 set operating mode function.
This function sets the operating mode of the sensor ( FORCED or SLEEP ).
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | op_mode | : 0 - SLEEP, 1 - FORCED. |
0
- Success, -1
- Error. -2
- Communication fail. int8_t environment3_set_regs | ( | environment3_t * | ctx, |
uint8_t * | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Environment 3 write data to registers function.
This function writes the desired number of data bytes to registers starting from the given register address of sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | reg | : Array of registers addresses. |
[in] | data_in | : Array of data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error. -2
- Communication fail. -3
- Invalid length. int8_t environment3_set_sensor_conf | ( | environment3_t * | ctx, |
environment3_tph_settings_t * | conf ) |
Environment 3 set sensor configuration function.
This function sets the oversampling, filter and odr configuration of the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | conf | : THP setting object. See environment3_tph_settings_t TPH setting object definition for detailed explanation. |
0
- Success, -1
- Error. -2
- Communication fail. int8_t environment3_soft_reset | ( | environment3_t * | ctx | ) |
Environment 3 soft reset function.
This function soft-resets the sensor.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t environment3_write_byte | ( | environment3_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Environment 3 single data writing function.
This function writes a single data byte to the desired register.
[in] | ctx | : Click context object. See environment3_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.