LibDriver APM2000
Loading...
Searching...
No Matches
apm2000 basic driver function

apm2000 basic driver modules More...

Collaboration diagram for apm2000 basic driver function:

Data Structures

struct  apm2000_handle_s
 apm2000 handle structure definition More...
struct  apm2000_pm_s
 apm2000 pm structure definition More...
struct  apm2000_info_s
 apm2000 information structure definition More...

Typedefs

typedef struct apm2000_handle_s apm2000_handle_t
 apm2000 handle structure definition
typedef struct apm2000_pm_s apm2000_pm_t
 apm2000 pm structure definition
typedef struct apm2000_info_s apm2000_info_t
 apm2000 information structure definition

Enumerations

enum  apm2000_interface_t { APM2000_INTERFACE_IIC = 0x00 , APM2000_INTERFACE_UART = 0x01 }
 apm2000 interface enumeration definition More...

Functions

uint8_t apm2000_info (apm2000_info_t *info)
 get chip information
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_init (apm2000_handle_t *handle)
 initialize the chip
uint8_t apm2000_deinit (apm2000_handle_t *handle)
 close the chip
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_start_measurement (apm2000_handle_t *handle)
 start the measurement
uint8_t apm2000_stop_measurement (apm2000_handle_t *handle)
 stop the measurement

Detailed Description

apm2000 basic driver modules

Typedef Documentation

◆ apm2000_handle_t

apm2000 handle structure definition

◆ apm2000_info_t

apm2000 information structure definition

◆ apm2000_pm_t

typedef struct apm2000_pm_s apm2000_pm_t

apm2000 pm structure definition

Enumeration Type Documentation

◆ apm2000_interface_t

apm2000 interface enumeration definition

Enumerator
APM2000_INTERFACE_IIC 

iic interface

APM2000_INTERFACE_UART 

uart interface

Definition at line 62 of file driver_apm2000.h.

Function Documentation

◆ apm2000_deinit()

uint8_t apm2000_deinit ( apm2000_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an apm2000 handle structure
Returns
status code
  • 0 success
  • 1 iic or uart deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 678 of file driver_apm2000.c.

◆ apm2000_get_interface()

uint8_t apm2000_get_interface ( apm2000_handle_t * handle,
apm2000_interface_t * interface )

get the chip interface

Parameters
[in]*handlepointer to an apm2000 handle structure
[out]*interfacepointer to a chip interface buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 301 of file driver_apm2000.c.

◆ apm2000_info()

uint8_t apm2000_info ( apm2000_info_t * info)

get chip information

Parameters
[out]*infopointer to an apm2000 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 830 of file driver_apm2000.c.

◆ apm2000_init()

uint8_t apm2000_init ( apm2000_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an apm2000 handle structure
Returns
status code
  • 0 success
  • 1 iic or uart initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 574 of file driver_apm2000.c.

◆ apm2000_read()

uint8_t apm2000_read ( apm2000_handle_t * handle,
apm2000_pm_t * pm )

read the result

Parameters
[in]*handlepointer to an apm2000 handle structure
[out]*pmpointer to an apm2000 pm structure
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 crc check failed
Note
none

Definition at line 417 of file driver_apm2000.c.

◆ apm2000_read_pm2p5()

uint8_t apm2000_read_pm2p5 ( apm2000_handle_t * handle,
uint16_t * pm2p5_ug_m3 )

read pm2.5

Parameters
[in]*handlepointer to an apm2000 handle structure
[out]*pm2p5_ug_m3pointer to a data buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 iic can't use this function
Note
iic can't use this function

Definition at line 511 of file driver_apm2000.c.

◆ apm2000_set_interface()

uint8_t apm2000_set_interface ( apm2000_handle_t * handle,
apm2000_interface_t interface )

set the chip interface

Parameters
[in]*handlepointer to an apm2000 handle structure
[in]interfacechip interface
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 280 of file driver_apm2000.c.

◆ apm2000_start_measurement()

uint8_t apm2000_start_measurement ( apm2000_handle_t * handle)

start the measurement

Parameters
[in]*handlepointer to an apm2000 handle structure
Returns
status code
  • 0 success
  • 1 start measurement failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 uart can't use this function
Note
uart can't use this function

Definition at line 324 of file driver_apm2000.c.

◆ apm2000_stop_measurement()

uint8_t apm2000_stop_measurement ( apm2000_handle_t * handle)

stop the measurement

Parameters
[in]*handlepointer to an apm2000 handle structure
Returns
status code
  • 0 success
  • 1 stop measurement failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 uart can't use this function
Note
uart can't use this function

Definition at line 372 of file driver_apm2000.c.