37 #ifndef DRIVER_SPS30_H
38 #define DRIVER_SPS30_H
168 #define DRIVER_SPS30_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
176 #define DRIVER_SPS30_LINK_UART_INIT(HANDLE, FUC) (HANDLE)->uart_init = FUC
184 #define DRIVER_SPS30_LINK_UART_DEINIT(HANDLE, FUC) (HANDLE)->uart_deinit = FUC
192 #define DRIVER_SPS30_LINK_UART_READ(HANDLE, FUC) (HANDLE)->uart_read = FUC
200 #define DRIVER_SPS30_LINK_UART_WRITE(HANDLE, FUC) (HANDLE)->uart_write = FUC
208 #define DRIVER_SPS30_LINK_UART_FLUSH(HANDLE, FUC) (HANDLE)->uart_flush = FUC
216 #define DRIVER_SPS30_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
224 #define DRIVER_SPS30_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
232 #define DRIVER_SPS30_LINK_IIC_WRITE_COMMAND(HANDLE, FUC) (HANDLE)->iic_write_cmd = FUC
240 #define DRIVER_SPS30_LINK_IIC_READ_COMMAND(HANDLE, FUC) (HANDLE)->iic_read_cmd = FUC
248 #define DRIVER_SPS30_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
256 #define DRIVER_SPS30_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t sps30_get_interface(sps30_handle_t *handle, sps30_interface_t *interface)
get the chip interface
uint8_t sps30_set_auto_cleaning_interval(sps30_handle_t *handle, uint32_t second)
set the auto cleaning interval
sps30_data_ready_flag_t
sps30 data ready flag enumeration definition
uint8_t sps30_start_fan_cleaning(sps30_handle_t *handle)
start the fan cleaning
uint8_t sps30_get_auto_cleaning_interval(sps30_handle_t *handle, uint32_t *second)
get the auto cleaning interval
uint8_t sps30_read(sps30_handle_t *handle, sps30_pm_t *pm)
read the result
struct sps30_info_s sps30_info_t
sps30 information structure definition
uint8_t sps30_wake_up(sps30_handle_t *handle)
wake up the chip
sps30_interface_t
sps30 interface enumeration definition
uint8_t sps30_start_measurement(sps30_handle_t *handle, sps30_format_t format)
start the measurement
uint8_t sps30_stop_measurement(sps30_handle_t *handle)
stop the measurement
sps30_format_t
sps30 format enumeration definition
uint8_t sps30_get_product_type(sps30_handle_t *handle, char type[9])
get the product type
uint8_t sps30_get_device_status(sps30_handle_t *handle, uint32_t *status)
get the device status
uint8_t sps30_disable_auto_cleaning_interval(sps30_handle_t *handle)
disable the auto cleaning interval
uint8_t sps30_reset(sps30_handle_t *handle)
reset the chip
struct sps30_handle_s sps30_handle_t
sps30 handle structure definition
uint8_t sps30_read_data_flag(sps30_handle_t *handle, sps30_data_ready_flag_t *flag)
read the data read flag
uint8_t sps30_info(sps30_info_t *info)
get chip information
uint8_t sps30_deinit(sps30_handle_t *handle)
close the chip
uint8_t sps30_init(sps30_handle_t *handle)
initialize the chip
uint8_t sps30_sleep(sps30_handle_t *handle)
enter the sleep mode
uint8_t sps30_set_interface(sps30_handle_t *handle, sps30_interface_t interface)
set the chip interface
uint8_t sps30_clear_device_status(sps30_handle_t *handle)
clear the device status
struct sps30_pm_s sps30_pm_t
sps30 pm structure definition
uint8_t sps30_get_version(sps30_handle_t *handle, uint8_t *major, uint8_t *minor)
get the version
uint8_t sps30_get_serial_number(sps30_handle_t *handle, char sn[17])
get the serial number
sps30_status_t
sps30 status enumeration definition
@ SPS30_DATA_READY_FLAG_AVAILABLE
@ SPS30_DATA_READY_FLAG_NOT_READY
@ SPS30_STATUS_LASER_ERROR
@ SPS30_STATUS_FAN_SPEED_ERROR
uint8_t sps30_get_reg_iic(sps30_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
get the chip register with iic interface
uint8_t sps30_set_get_reg_uart(sps30_handle_t *handle, uint8_t *input, uint16_t in_len, uint8_t *output, uint16_t out_len)
set and get the chip register with uart interface
uint8_t sps30_set_reg_iic(sps30_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
set the chip register with iic interface
sps30 handle structure definition
uint8_t(* uart_flush)(void)
uint8_t(* uart_write)(uint8_t *buf, uint16_t len)
void(* delay_ms)(uint32_t ms)
uint8_t(* uart_deinit)(void)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint16_t(* uart_read)(uint8_t *buf, uint16_t len)
uint8_t(* iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
uint8_t(* uart_init)(void)
uint8_t(* iic_deinit)(void)
uint8_t(* iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
sps30 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v
sps30 pm structure definition
float typical_particle_um