LibDriver SEN5X
Loading...
Searching...
No Matches
driver_sen5x.h File Reference

driver sen5x header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
Include dependency graph for driver_sen5x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sen55_data_s
 sen55 data structure definition More...
struct  sen54_data_s
 sen54 data structure definition More...
struct  sen50_data_s
 sen50 data structure definition More...
struct  sen5x_pm_s
 sen5x pm structure definition More...
struct  sen5x_raw_s
 sen5x raw structure definition More...
struct  sen5x_handle_s
 sen5x handle structure definition More...
struct  sen5x_info_s
 sen5x information structure definition More...

Macros

#define DRIVER_SEN5X_LINK_INIT(HANDLE, STRUCTURE)
 initialize sen5x_handle_t structure
#define DRIVER_SEN5X_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_SEN5X_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_SEN5X_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_SEN5X_LINK_IIC_READ_COMMAND(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_SEN5X_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_SEN5X_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct sen55_data_s sen55_data_t
 sen55 data structure definition
typedef struct sen54_data_s sen54_data_t
 sen54 data structure definition
typedef struct sen50_data_s sen50_data_t
 sen50 data structure definition
typedef struct sen5x_pm_s sen5x_pm_t
 sen5x pm structure definition
typedef struct sen5x_raw_s sen5x_raw_t
 sen5x raw structure definition
typedef struct sen5x_handle_s sen5x_handle_t
 sen5x handle structure definition
typedef struct sen5x_info_s sen5x_info_t
 sen5x information structure definition

Enumerations

enum  sen5x_type_t { SEN50 = 0x00 , SEN54 = 0x01 , SEN55 = 0x02 }
 sen5x type enumeration definition More...
enum  sen5x_data_ready_flag_t { SEN5X_DATA_READY_FLAG_NOT_READY = 0x00 , SEN5X_DATA_READY_FLAG_AVAILABLE = 0x01 }
 sen5x data ready flag enumeration definition More...
enum  sen5x_status_t {
  SEN5X_STATUS_FAN_SPEED_ERROR = (1 << 21) , SEN5X_STATUS_FAN_CLEANING_ACTIVE = (1 << 19) , SEN5X_STATUS_GAS_ERROR = (1 << 7) , SEN5X_STATUS_RHT_ERROR = (1 << 6) ,
  SEN5X_STATUS_LASER_ERROR = (1 << 5) , SEN5X_STATUS_FAN_ERROR = (1 << 4)
}
 sen5x status enumeration definition More...
enum  sen5x_rht_acceleration_mode_t { SEN5X_RHT_ACCELERATION_LOW = 0 , SEN5X_RHT_ACCELERATION_HIGH = 1 , SEN5X_RHT_ACCELERATION_MEDIUM = 2 }
 sen5x rht acceleration mode enumeration definition More...

Functions

uint8_t sen5x_info (sen5x_info_t *info)
 get chip information
uint8_t sen5x_set_type (sen5x_handle_t *handle, sen5x_type_t type)
 set the chip type
uint8_t sen5x_get_type (sen5x_handle_t *handle, sen5x_type_t *type)
 get the chip type
uint8_t sen5x_init (sen5x_handle_t *handle)
 initialize the chip
uint8_t sen5x_deinit (sen5x_handle_t *handle)
 close the chip
uint8_t sen5x_start_measurement (sen5x_handle_t *handle)
 start the measurement
uint8_t sen5x_start_measurement_without_pm (sen5x_handle_t *handle)
 start the measurement without pm
uint8_t sen5x_stop_measurement (sen5x_handle_t *handle)
 stop the measurement
uint8_t sen5x_read_data_flag (sen5x_handle_t *handle, sen5x_data_ready_flag_t *flag)
 read the data flag
uint8_t sen55_read (sen5x_handle_t *handle, sen55_data_t *output)
 read the result
uint8_t sen54_read (sen5x_handle_t *handle, sen54_data_t *output)
 read the result
uint8_t sen50_read (sen5x_handle_t *handle, sen50_data_t *output)
 read the result
uint8_t sen5x_read_pm_value (sen5x_handle_t *handle, sen5x_pm_t *pm)
 read the pm value
uint8_t sen5x_read_raw_value (sen5x_handle_t *handle, sen5x_raw_t *raw)
 read raw value
uint8_t sen5x_set_temperature_compensation (sen5x_handle_t *handle, int16_t temperature_offset, int16_t normalized_temperature_offset_slope, uint16_t time_constant)
 set temperature compensation
uint8_t sen5x_get_temperature_compensation (sen5x_handle_t *handle, int16_t *temperature_offset, int16_t *normalized_temperature_offset_slope, uint16_t *time_constant)
 get temperature compensation
uint8_t sen5x_temperature_compensation_convert_to_register (sen5x_handle_t *handle, float temperature_offset_degree, float normalized_temperature_offset_slope_factor, float time_constant_second, int16_t *temperature_offset_reg, int16_t *normalized_temperature_offset_slope_reg, uint16_t *time_constant_reg)
 convert the temperature compensation to the register raw data
uint8_t sen5x_temperature_compensation_convert_to_data (sen5x_handle_t *handle, int16_t temperature_offset_reg, int16_t normalized_temperature_offset_slope_reg, uint16_t time_constant_reg, float *temperature_offset_degree, float *normalized_temperature_offset_slope_factor, float *time_constant_second)
 convert the temperature compensation to the real data
uint8_t sen5x_set_warm_start (sen5x_handle_t *handle, uint16_t param)
 set warm start
uint8_t sen5x_get_warm_start (sen5x_handle_t *handle, uint16_t *param)
 get warm start
uint8_t sen5x_set_voc_algorithm_tuning (sen5x_handle_t *handle, int16_t index_offset, int16_t learning_time_offset_hour, int16_t learning_time_gain_hour, int16_t gating_max_duration_minute, int16_t std_initial, int16_t gain_factor)
 set voc algorithm tuning
uint8_t sen5x_get_voc_algorithm_tuning (sen5x_handle_t *handle, int16_t *index_offset, int16_t *learning_time_offset_hour, int16_t *learning_time_gain_hour, int16_t *gating_max_duration_minute, int16_t *std_initial, int16_t *gain_factor)
 get voc algorithm tuning
uint8_t sen5x_set_nox_algorithm_tuning (sen5x_handle_t *handle, int16_t index_offset, int16_t learning_time_offset_hour, int16_t learning_time_gain_hour, int16_t gating_max_duration_minute, int16_t std_initial, int16_t gain_factor)
 set nox algorithm tuning
uint8_t sen5x_get_nox_algorithm_tuning (sen5x_handle_t *handle, int16_t *index_offset, int16_t *learning_time_offset_hour, int16_t *learning_time_gain_hour, int16_t *gating_max_duration_minute, int16_t *std_initial, int16_t *gain_factor)
 get nox algorithm tuning
uint8_t sen5x_set_rht_acceleration_mode (sen5x_handle_t *handle, sen5x_rht_acceleration_mode_t mode)
 set rht acceleration mode
uint8_t sen5x_get_rht_acceleration_mode (sen5x_handle_t *handle, sen5x_rht_acceleration_mode_t *mode)
 get rht acceleration mode
uint8_t sen5x_set_voc_algorithm_state (sen5x_handle_t *handle, uint16_t state[4])
 set voc algorithm state
uint8_t sen5x_get_voc_algorithm_state (sen5x_handle_t *handle, uint16_t state[4])
 get voc algorithm state
uint8_t sen5x_start_fan_cleaning (sen5x_handle_t *handle)
 start the fan cleaning
uint8_t sen5x_set_auto_cleaning_interval (sen5x_handle_t *handle, uint32_t second)
 set the auto cleaning interval
uint8_t sen5x_get_auto_cleaning_interval (sen5x_handle_t *handle, uint32_t *second)
 get the auto cleaning interval
uint8_t sen5x_disable_auto_cleaning_interval (sen5x_handle_t *handle)
 disable the auto cleaning interval
uint8_t sen5x_get_product_name (sen5x_handle_t *handle, char name[32])
 get the product name
uint8_t sen5x_get_serial_number (sen5x_handle_t *handle, char sn[32])
 get the serial number
uint8_t sen5x_get_version (sen5x_handle_t *handle, uint8_t *version)
 get the version
uint8_t sen5x_get_device_status (sen5x_handle_t *handle, uint32_t *status)
 get the device status
uint8_t sen5x_clear_device_status (sen5x_handle_t *handle)
 clear the device status
uint8_t sen5x_reset (sen5x_handle_t *handle)
 reset the chip
uint8_t sen5x_set_reg (sen5x_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t sen5x_get_reg (sen5x_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver sen5x header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-06-15

history

Date Version Author Description
2025/06/15 1.0 Shifeng Li first upload

Definition in file driver_sen5x.h.