![]() |
LibDriver SPS30
1.0.0
SPS30 full-featured driver
|
driver sps30 header file More...
#include <stdio.h>
#include <stdint.h>
#include <string.h>
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) memset(HANDLE, 0, sizeof(STRUCTURE)) |
initialize sps30_handle_t structure More... | |
#define | DRIVER_SPS30_LINK_UART_INIT(HANDLE, FUC) (HANDLE)->uart_init = FUC |
link uart_init function More... | |
#define | DRIVER_SPS30_LINK_UART_DEINIT(HANDLE, FUC) (HANDLE)->uart_deinit = FUC |
link uart_deinit function More... | |
#define | DRIVER_SPS30_LINK_UART_READ(HANDLE, FUC) (HANDLE)->uart_read = FUC |
link uart_read function More... | |
#define | DRIVER_SPS30_LINK_UART_WRITE(HANDLE, FUC) (HANDLE)->uart_write = FUC |
link uart_write function More... | |
#define | DRIVER_SPS30_LINK_UART_FLUSH(HANDLE, FUC) (HANDLE)->uart_flush = FUC |
link uart_flush function More... | |
#define | DRIVER_SPS30_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC |
link iic_init function More... | |
#define | DRIVER_SPS30_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC |
link iic_deinit function More... | |
#define | DRIVER_SPS30_LINK_IIC_WRITE_COMMAND(HANDLE, FUC) (HANDLE)->iic_write_cmd = FUC |
link iic_write_cmd function More... | |
#define | DRIVER_SPS30_LINK_IIC_READ_COMMAND(HANDLE, FUC) (HANDLE)->iic_read_cmd = FUC |
link iic_read_cmd function More... | |
#define | DRIVER_SPS30_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC |
link delay_ms function More... | |
#define | DRIVER_SPS30_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC |
link debug_print function More... | |
Typedefs | |
typedef struct sps30_handle_s | sps30_handle_t |
sps30 handle structure definition More... | |
typedef struct sps30_pm_s | sps30_pm_t |
sps30 pm structure definition More... | |
typedef struct sps30_info_s | sps30_info_t |
sps30 information structure definition More... | |
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 More... | |
uint8_t | sps30_set_interface (sps30_handle_t *handle, sps30_interface_t interface) |
set the chip interface More... | |
uint8_t | sps30_get_interface (sps30_handle_t *handle, sps30_interface_t *interface) |
get the chip interface More... | |
uint8_t | sps30_init (sps30_handle_t *handle) |
initialize the chip More... | |
uint8_t | sps30_deinit (sps30_handle_t *handle) |
close the chip More... | |
uint8_t | sps30_read (sps30_handle_t *handle, sps30_pm_t *pm) |
read the result More... | |
uint8_t | sps30_sleep (sps30_handle_t *handle) |
enter the sleep mode More... | |
uint8_t | sps30_reset (sps30_handle_t *handle) |
reset the chip More... | |
uint8_t | sps30_wake_up (sps30_handle_t *handle) |
wake up the chip More... | |
uint8_t | sps30_start_measurement (sps30_handle_t *handle, sps30_format_t format) |
start the measurement More... | |
uint8_t | sps30_stop_measurement (sps30_handle_t *handle) |
stop the measurement More... | |
uint8_t | sps30_read_data_flag (sps30_handle_t *handle, sps30_data_ready_flag_t *flag) |
read the data read flag More... | |
uint8_t | sps30_start_fan_cleaning (sps30_handle_t *handle) |
start the fan cleaning More... | |
uint8_t | sps30_set_auto_cleaning_interval (sps30_handle_t *handle, uint32_t second) |
set the auto cleaning interval More... | |
uint8_t | sps30_get_auto_cleaning_interval (sps30_handle_t *handle, uint32_t *second) |
get the auto cleaning interval More... | |
uint8_t | sps30_disable_auto_cleaning_interval (sps30_handle_t *handle) |
disable the auto cleaning interval More... | |
uint8_t | sps30_get_product_type (sps30_handle_t *handle, char type[9]) |
get the product type More... | |
uint8_t | sps30_get_serial_number (sps30_handle_t *handle, char sn[17]) |
get the serial number More... | |
uint8_t | sps30_get_version (sps30_handle_t *handle, uint8_t *major, uint8_t *minor) |
get the version More... | |
uint8_t | sps30_get_device_status (sps30_handle_t *handle, uint32_t *status) |
get the device status More... | |
uint8_t | sps30_clear_device_status (sps30_handle_t *handle) |
clear the device status More... | |
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 More... | |
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 More... | |
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 More... | |
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.
Date | Version | Author | Description |
---|---|---|---|
2021/07/25 | 1.0 | Shifeng Li | first upload |
Definition in file driver_sps30.h.