LibDriver SPS30
Loading...
Searching...
No Matches
driver_sps30.h File Reference

driver sps30 header file More...

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

Go to the source code of this file.

Data Structures

struct  sps30_handle_s
 sps30 handle structure definition More...
struct  sps30_pm_s
 sps30 pm structure definition More...
struct  sps30_info_s
 sps30 information structure definition More...

Macros

#define DRIVER_SPS30_LINK_INIT(HANDLE, STRUCTURE)
 initialize sps30_handle_t structure
#define DRIVER_SPS30_LINK_UART_INIT(HANDLE, FUC)
 link uart_init function
#define DRIVER_SPS30_LINK_UART_DEINIT(HANDLE, FUC)
 link uart_deinit function
#define DRIVER_SPS30_LINK_UART_READ(HANDLE, FUC)
 link uart_read function
#define DRIVER_SPS30_LINK_UART_WRITE(HANDLE, FUC)
 link uart_write function
#define DRIVER_SPS30_LINK_UART_FLUSH(HANDLE, FUC)
 link uart_flush function
#define DRIVER_SPS30_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_SPS30_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_SPS30_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_SPS30_LINK_IIC_READ_COMMAND(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_SPS30_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_SPS30_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct sps30_handle_s sps30_handle_t
 sps30 handle structure definition
typedef struct sps30_pm_s sps30_pm_t
 sps30 pm structure definition
typedef struct sps30_info_s sps30_info_t
 sps30 information structure definition

Enumerations

enum  sps30_interface_t { SPS30_INTERFACE_IIC = 0x00 , SPS30_INTERFACE_UART = 0x01 }
 sps30 interface enumeration definition More...
enum  sps30_format_t { SPS30_FORMAT_IEEE754 = 0x03 , SPS30_FORMAT_UINT16 = 0x05 }
 sps30 format enumeration definition More...
enum  sps30_data_ready_flag_t { SPS30_DATA_READY_FLAG_NOT_READY = 0x00 , SPS30_DATA_READY_FLAG_AVAILABLE = 0x01 }
 sps30 data ready flag enumeration definition More...
enum  sps30_status_t { SPS30_STATUS_FAN_SPEED_ERROR = (1 << 21) , SPS30_STATUS_LASER_ERROR = (1 << 5) , SPS30_STATUS_FAN_ERROR = (1 << 4) }
 sps30 status enumeration definition More...

Functions

uint8_t sps30_info (sps30_info_t *info)
 get chip information
uint8_t sps30_set_interface (sps30_handle_t *handle, sps30_interface_t interface)
 set the chip interface
uint8_t sps30_get_interface (sps30_handle_t *handle, sps30_interface_t *interface)
 get the chip interface
uint8_t sps30_init (sps30_handle_t *handle)
 initialize the chip
uint8_t sps30_deinit (sps30_handle_t *handle)
 close the chip
uint8_t sps30_read (sps30_handle_t *handle, sps30_pm_t *pm)
 read the result
uint8_t sps30_sleep (sps30_handle_t *handle)
 enter the sleep mode
uint8_t sps30_reset (sps30_handle_t *handle)
 reset the chip
uint8_t sps30_wake_up (sps30_handle_t *handle)
 wake up the chip
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
uint8_t sps30_read_data_flag (sps30_handle_t *handle, sps30_data_ready_flag_t *flag)
 read the data read flag
uint8_t sps30_start_fan_cleaning (sps30_handle_t *handle)
 start the fan cleaning
uint8_t sps30_set_auto_cleaning_interval (sps30_handle_t *handle, uint32_t second)
 set the auto cleaning interval
uint8_t sps30_get_auto_cleaning_interval (sps30_handle_t *handle, uint32_t *second)
 get the auto cleaning interval
uint8_t sps30_disable_auto_cleaning_interval (sps30_handle_t *handle)
 disable the auto cleaning interval
uint8_t sps30_get_product_type (sps30_handle_t *handle, char type[9])
 get the product type
uint8_t sps30_get_serial_number (sps30_handle_t *handle, char sn[17])
 get the serial number
uint8_t sps30_get_version (sps30_handle_t *handle, uint8_t *major, uint8_t *minor)
 get the version
uint8_t sps30_get_device_status (sps30_handle_t *handle, uint32_t *status)
 get the device status
uint8_t sps30_clear_device_status (sps30_handle_t *handle)
 clear the device status
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
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

Detailed Description

driver sps30 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
2021-07-25

history

Date Version Author Description
2021/07/25 1.0 Shifeng Li first upload

Definition in file driver_sps30.h.