37#ifndef DRIVER_APM2000_H
38#define DRIVER_APM2000_H
132#define DRIVER_APM2000_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
140#define DRIVER_APM2000_LINK_UART_INIT(HANDLE, FUC) (HANDLE)->uart_init = FUC
148#define DRIVER_APM2000_LINK_UART_DEINIT(HANDLE, FUC) (HANDLE)->uart_deinit = FUC
156#define DRIVER_APM2000_LINK_UART_READ(HANDLE, FUC) (HANDLE)->uart_read = FUC
164#define DRIVER_APM2000_LINK_UART_WRITE(HANDLE, FUC) (HANDLE)->uart_write = FUC
172#define DRIVER_APM2000_LINK_UART_FLUSH(HANDLE, FUC) (HANDLE)->uart_flush = FUC
180#define DRIVER_APM2000_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
188#define DRIVER_APM2000_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
196#define DRIVER_APM2000_LINK_IIC_WRITE_ADDRESS16(HANDLE, FUC) (HANDLE)->iic_write_address16 = FUC
204#define DRIVER_APM2000_LINK_IIC_READ_ADDRESS16(HANDLE, FUC) (HANDLE)->iic_read_address16 = FUC
212#define DRIVER_APM2000_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
220#define DRIVER_APM2000_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t apm2000_deinit(apm2000_handle_t *handle)
close the chip
struct apm2000_pm_s apm2000_pm_t
apm2000 pm structure definition
uint8_t apm2000_read_pm2p5(apm2000_handle_t *handle, uint16_t *pm2p5_ug_m3)
read pm2.5
uint8_t apm2000_get_interface(apm2000_handle_t *handle, apm2000_interface_t *interface)
get the chip interface
struct apm2000_info_s apm2000_info_t
apm2000 information structure definition
uint8_t apm2000_set_interface(apm2000_handle_t *handle, apm2000_interface_t interface)
set the chip interface
uint8_t apm2000_stop_measurement(apm2000_handle_t *handle)
stop the measurement
struct apm2000_handle_s apm2000_handle_t
apm2000 handle structure definition
uint8_t apm2000_init(apm2000_handle_t *handle)
initialize the chip
apm2000_interface_t
apm2000 interface enumeration definition
uint8_t apm2000_start_measurement(apm2000_handle_t *handle)
start the measurement
uint8_t apm2000_read(apm2000_handle_t *handle, apm2000_pm_t *pm)
read the result
uint8_t apm2000_info(apm2000_info_t *info)
get chip information
uint8_t apm2000_set_get_reg_uart(apm2000_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 apm2000_get_reg_iic(apm2000_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
get the chip register with iic interface
uint8_t apm2000_set_reg_iic(apm2000_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
set the chip register with iic interface
apm2000 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)
uint8_t(* iic_read_address16)(uint8_t addr, uint16_t reg, uint8_t *buf, uint16_t len)
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_write_address16)(uint8_t addr, uint16_t reg, uint8_t *buf, uint16_t len)
uint8_t(* uart_init)(void)
uint8_t(* iic_deinit)(void)
apm2000 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v
apm2000 pm structure definition