Driver for I2C communication to SEN5x devices. More...
Driver for I2C communication to SEN5x devices.
Files | |
file | sen5x.h |
file | sen5x_constants.h |
Internal addresses, registers and constants. | |
file | sen5x_params.h |
Default configuration for SEN50/54/55. | |
Data Structures | |
struct | sen5x_measurement_t |
Wrapper for measured values. More... | |
struct | sen5x_params_t |
Device initialization parameters. More... | |
struct | sen5x_t |
Device descriptor for the driver. More... | |
Functions | |
int | sen5x_init (sen5x_t *dev, const sen5x_params_t *params) |
Initialize the given device. | |
int | sen5x_reset (const sen5x_t *dev) |
Execute a reset on the given device. | |
void | sen5x_wake (const sen5x_t *dev) |
Starts a continuous measurement. | |
void | sen5x_wake_no_pm (const sen5x_t *dev) |
Starts a continuous measurement without PM. | |
void | sen5x_sleep (const sen5x_t *dev) |
Stops the measurement and returns to idle mode. | |
void | sen5x_clean_fan (const sen5x_t *dev) |
Sets the fan to maximum speed, to clean it within 10 seconds. | |
bool | sen5x_data_ready_flag (const sen5x_t *dev) |
Sets the fan to maximum speed, to clean it within 10 seconds. | |
void | sen5x_read_values (const sen5x_t *dev, sen5x_measurement_t *values) |
Read measured mass concentration, humidity and temperature values. | |
void | sen5x_read_pm_values (const sen5x_t *dev, sen5x_measurement_t *values) |
Read measured particle matter values. | |
void | sen5x_set_temperature_offset (const sen5x_t *dev, int16_t temp_offset, int16_t slope, uint16_t time_constant) |
Set a custom temperature offset to the ambient temperature. | |
void | sen5x_get_temperature_offset (const sen5x_t *dev, int16_t *temp_offset, int16_t *slope, uint16_t *time_constant) |
Set a custom temperature offset to the ambient temperature. | |
void | sen5x_set_warm_start (const sen5x_t *dev, uint16_t warm_start) |
Set the parameter for a warm start on the device, to improve initial accuracy of the ambient temperature output. | |
void | sen5x_get_warm_start (const sen5x_t *dev, uint16_t *warm_start) |
Get the warm start parameter. | |
void | sen5x_set_voc_algorithm_tuning (const sen5x_t *dev, int16_t index_offset, int16_t learning_time_offset_hours, int16_t learning_time_gain_hours, int16_t gating_max_duration_minutes, int16_t std_initial, int16_t gain_factor) |
Set the parameters for the VOC Algorithm tuning. | |
void | sen5x_get_voc_algorithm_tuning (const sen5x_t *dev, int16_t *index_offset, int16_t *learning_time_offset_hours, int16_t *learning_time_gain_hours, int16_t *gating_max_duration_minutes, int16_t *std_initial, int16_t *gain_factor) |
Get the VOC Algorithm tuning parameters. | |
void | sen5x_set_nox_algorithm_tuning (const sen5x_t *dev, int16_t index_offset, int16_t learning_time_offset_hours, int16_t learning_time_gain_hours, int16_t gating_max_duration_minutes, int16_t std_initial, int16_t gain_factor) |
Set the parameters for the NOx Algorithm tuning. | |
void | sen5x_get_nox_algorithm_tuning (const sen5x_t *dev, int16_t *index_offset, int16_t *learning_time_offset_hours, int16_t *learning_time_gain_hours, int16_t *gating_max_duration_minutes, int16_t *std_initial, int16_t *gain_factor) |
Get the NOx Algorithm tuning parameters. | |
void | sen5x_set_rht_acceleration (const sen5x_t *dev, uint16_t mode) |
Set the mode for the RH/T acceleration algorithm. | |
void | sen5x_get_rht_acceleration (const sen5x_t *dev, uint16_t *mode) |
Get the mode for the RH/T acceleration algorithm. | |
void | sen5x_set_voc_state (const sen5x_t *dev, const uint8_t *state, uint8_t state_size) |
Get the VOC Algorithm state. | |
void | sen5x_get_voc_state (const sen5x_t *dev, uint8_t *state, uint8_t state_size) |
Set the VOC Algorithm state. | |
void sen5x_clean_fan | ( | const sen5x_t * | dev | ) |
Sets the fan to maximum speed, to clean it within 10 seconds.
[in,out] | dev | Device descriptor of the driver |
bool sen5x_data_ready_flag | ( | const sen5x_t * | dev | ) |
Sets the fan to maximum speed, to clean it within 10 seconds.
[in,out] | dev | Device descriptor of the driver |
void sen5x_get_nox_algorithm_tuning | ( | const sen5x_t * | dev, |
int16_t * | index_offset, | ||
int16_t * | learning_time_offset_hours, | ||
int16_t * | learning_time_gain_hours, | ||
int16_t * | gating_max_duration_minutes, | ||
int16_t * | std_initial, | ||
int16_t * | gain_factor ) |
Get the NOx Algorithm tuning parameters.
[in,out] | dev | Device descriptor of the driver |
[out] | index_offset | NOx index representing typical(average) conditions |
[out] | learning_time_offset_hours | Time constant to estimate the NOx algorithm offset from the history in hours |
[out] | learning_time_gain_hours | The time constant to estimate the NOx algorithm gain from the history has no impact for NOx. This parameter is still in place for consistency reasons with the VOC tuning parameters command. This parameter must always be set to 12 hours |
[out] | gating_max_duration_minutes | Maximum duration of gating in minutes |
[out] | std_initial | Initial estimate for standard deviation |
[out] | gain_factor | Gain factor to amplify or to attenuate the NOx index output |
void sen5x_get_rht_acceleration | ( | const sen5x_t * | dev, |
uint16_t * | mode ) |
Get the mode for the RH/T acceleration algorithm.
[in,out] | dev | Device descriptor of the driver |
[out] | mode | RH/T acceleration mode: = 0: Low Acceleration = 1: High Acceleration = 2: Medium Acceleration |
void sen5x_get_temperature_offset | ( | const sen5x_t * | dev, |
int16_t * | temp_offset, | ||
int16_t * | slope, | ||
uint16_t * | time_constant ) |
Set a custom temperature offset to the ambient temperature.
[in,out] | dev | Device descriptor of the driver |
[out] | temp_offset | Temperature offset in °C |
[out] | slope | Normalized temperature offset slope |
[out] | time_constant | Time constant in seconds |
void sen5x_get_voc_algorithm_tuning | ( | const sen5x_t * | dev, |
int16_t * | index_offset, | ||
int16_t * | learning_time_offset_hours, | ||
int16_t * | learning_time_gain_hours, | ||
int16_t * | gating_max_duration_minutes, | ||
int16_t * | std_initial, | ||
int16_t * | gain_factor ) |
Get the VOC Algorithm tuning parameters.
[in,out] | dev | Device descriptor of the driver |
[out] | index_offset | VOC index representing typical (average) conditions |
[out] | learning_time_offset_hours | Time constant to estimate the VOC algorithm offset from the history in hours |
[out] | learning_time_gain_hours | Time constant to estimate the VOC algorithm gain from the history in hours |
[out] | gating_max_duration_minutes | Maximum duration of gating in minutes |
[out] | std_initial | Initial estimate for standard deviation |
[out] | gain_factor | Gain factor to amplify or to attenuate the VOC index output |
void sen5x_get_voc_state | ( | const sen5x_t * | dev, |
uint8_t * | state, | ||
uint8_t | state_size ) |
Set the VOC Algorithm state.
[in,out] | dev | Device descriptor of the driver |
[out] | state | VOC Algorithm state |
[in] | state_size | Size of the VOC Algorithm state |
void sen5x_get_warm_start | ( | const sen5x_t * | dev, |
uint16_t * | warm_start ) |
Get the warm start parameter.
[in,out] | dev | Device descriptor of the driver |
[out] | warm_start | Warm start behavior as a value in the range from 0 (cold start, default) to 65535 (warm start). |
int sen5x_init | ( | sen5x_t * | dev, |
const sen5x_params_t * | params ) |
Initialize the given device.
[in,out] | dev | Device descriptor of the driver |
[in] | params | Initialization parameters |
void sen5x_read_pm_values | ( | const sen5x_t * | dev, |
sen5x_measurement_t * | values ) |
Read measured particle matter values.
[in,out] | dev | Device descriptor of the driver |
[out] | values | Pointer to wrapper containing all measured values |
void sen5x_read_values | ( | const sen5x_t * | dev, |
sen5x_measurement_t * | values ) |
Read measured mass concentration, humidity and temperature values.
[in,out] | dev | Device descriptor of the driver |
[out] | values | Pointer to wrapper containing all measured values |
int sen5x_reset | ( | const sen5x_t * | dev | ) |
Execute a reset on the given device.
[in,out] | dev | Device descriptor of the driver |
void sen5x_set_nox_algorithm_tuning | ( | const sen5x_t * | dev, |
int16_t | index_offset, | ||
int16_t | learning_time_offset_hours, | ||
int16_t | learning_time_gain_hours, | ||
int16_t | gating_max_duration_minutes, | ||
int16_t | std_initial, | ||
int16_t | gain_factor ) |
Set the parameters for the NOx Algorithm tuning.
[in,out] | dev | Device descriptor of the driver |
[in] | index_offset | NOx index representing typical (average) conditions |
[in] | learning_time_offset_hours | Time constant to estimate the NOx algorithm offset from the history in hours |
[in] | learning_time_gain_hours | The time constant to estimate the NOx algorithm gain from the history has no impact for NOx. This parameter is still in place for consistency reasons with the VOC tuning parameters command. This parameter must always be set to 12 hours |
[in] | gating_max_duration_minutes | Maximum duration of gating in minutes |
[in] | std_initial | Initial estimate for standard deviation |
[in] | gain_factor | Gain factor to amplify or to attenuate the NOx index output |
void sen5x_set_rht_acceleration | ( | const sen5x_t * | dev, |
uint16_t | mode ) |
Set the mode for the RH/T acceleration algorithm.
[in,out] | dev | Device descriptor of the driver |
[in] | mode | RH/T acceleration mode: = 0: Low Acceleration = 1: High Acceleration = 2: Medium Acceleration |
void sen5x_set_temperature_offset | ( | const sen5x_t * | dev, |
int16_t | temp_offset, | ||
int16_t | slope, | ||
uint16_t | time_constant ) |
Set a custom temperature offset to the ambient temperature.
[in,out] | dev | Device descriptor of the driver |
[in] | temp_offset | Temperature offset in °C |
[in] | slope | Normalized temperature offset slope |
[in] | time_constant | Time constant in seconds |
void sen5x_set_voc_algorithm_tuning | ( | const sen5x_t * | dev, |
int16_t | index_offset, | ||
int16_t | learning_time_offset_hours, | ||
int16_t | learning_time_gain_hours, | ||
int16_t | gating_max_duration_minutes, | ||
int16_t | std_initial, | ||
int16_t | gain_factor ) |
Set the parameters for the VOC Algorithm tuning.
[in,out] | dev | Device descriptor of the driver |
[in] | index_offset | VOC index representing typical (average) conditions |
[in] | learning_time_offset_hours | Time constant to estimate the VOC algorithm offset from the history in hours |
[in] | learning_time_gain_hours | Time constant to estimate the VOC algorithm gain from the history in hours |
[in] | gating_max_duration_minutes | Maximum duration of gating in minutes |
[in] | std_initial | Initial estimate for standard deviation |
[in] | gain_factor | Gain factor to amplify or to attenuate the VOC index output |
void sen5x_set_voc_state | ( | const sen5x_t * | dev, |
const uint8_t * | state, | ||
uint8_t | state_size ) |
Get the VOC Algorithm state.
[in,out] | dev | Device descriptor of the driver |
[in] | state | VOC Algorithm state |
[in] | state_size | Size of the VOC Algorithm state |
void sen5x_set_warm_start | ( | const sen5x_t * | dev, |
uint16_t | warm_start ) |
Set the parameter for a warm start on the device, to improve initial accuracy of the ambient temperature output.
[in,out] | dev | Device descriptor of the driver |
[in] | warm_start | Warm start behavior as a value in the range from 0 (cold start, default) to 65535 (warm start). |
void sen5x_sleep | ( | const sen5x_t * | dev | ) |
Stops the measurement and returns to idle mode.
[in,out] | dev | Device descriptor of the driver |
void sen5x_wake | ( | const sen5x_t * | dev | ) |
Starts a continuous measurement.
[in,out] | dev | Device descriptor of the driver |
void sen5x_wake_no_pm | ( | const sen5x_t * | dev | ) |
Starts a continuous measurement without PM.
Only humidity, temperature, VOC and NOx are measured.
[in,out] | dev | Device descriptor of the driver |