LibDriver APM2000
Loading...
Searching...
No Matches
driver_apm2000.c File Reference

driver apm2000 source file More...

#include "driver_apm2000.h"
Include dependency graph for driver_apm2000.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "ASAIR APM2000"
 chip information definition
#define MANUFACTURER_NAME   "ASAIR"
#define SUPPLY_VOLTAGE_MIN   4.75f
#define SUPPLY_VOLTAGE_MAX   5.25f
#define MAX_CURRENT   100.0f
#define TEMPERATURE_MIN   -10.0f
#define TEMPERATURE_MAX   50.0f
#define DRIVER_VERSION   1000
#define APM2000_ADDRESS   (0x08 << 1)
 chip address definition
#define APM2000_REG_START   0x0010U
 chip reg definition
#define APM2000_REG_STOP   0x0104U
#define APM2000_REG_READ   0x0300U

Functions

uint8_t apm2000_set_interface (apm2000_handle_t *handle, apm2000_interface_t interface)
 set the chip interface
uint8_t apm2000_get_interface (apm2000_handle_t *handle, apm2000_interface_t *interface)
 get the chip interface
uint8_t apm2000_start_measurement (apm2000_handle_t *handle)
 start the measurement
uint8_t apm2000_stop_measurement (apm2000_handle_t *handle)
 stop the measurement
uint8_t apm2000_read (apm2000_handle_t *handle, apm2000_pm_t *pm)
 read the result
uint8_t apm2000_read_pm2p5 (apm2000_handle_t *handle, uint16_t *pm2p5_ug_m3)
 read pm2.5
uint8_t apm2000_init (apm2000_handle_t *handle)
 initialize the chip
uint8_t apm2000_deinit (apm2000_handle_t *handle)
 close the chip
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_set_reg_iic (apm2000_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
 set the chip register with iic 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_info (apm2000_info_t *info)
 get chip information

Detailed Description

driver apm2000 source 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-07-15

history

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

Definition in file driver_apm2000.c.

Macro Definition Documentation

◆ APM2000_ADDRESS

#define APM2000_ADDRESS   (0x08 << 1)

chip address definition

chip iic address

Definition at line 54 of file driver_apm2000.c.

◆ APM2000_REG_READ

#define APM2000_REG_READ   0x0300U

read measurement

Definition at line 61 of file driver_apm2000.c.

◆ APM2000_REG_START

#define APM2000_REG_START   0x0010U

chip reg definition

start measurement

Definition at line 59 of file driver_apm2000.c.

◆ APM2000_REG_STOP

#define APM2000_REG_STOP   0x0104U

stop measurement

Definition at line 60 of file driver_apm2000.c.

◆ CHIP_NAME

#define CHIP_NAME   "ASAIR APM2000"

chip information definition

chip name

Definition at line 42 of file driver_apm2000.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_apm2000.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "ASAIR"

manufacturer name

Definition at line 43 of file driver_apm2000.c.

◆ MAX_CURRENT

#define MAX_CURRENT   100.0f

chip max current

Definition at line 46 of file driver_apm2000.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.25f

chip max supply voltage

Definition at line 45 of file driver_apm2000.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   4.75f

chip min supply voltage

Definition at line 44 of file driver_apm2000.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   50.0f

chip max operating temperature

Definition at line 48 of file driver_apm2000.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -10.0f

chip min operating temperature

Definition at line 47 of file driver_apm2000.c.