LibDriver AM2320
Loading...
Searching...
No Matches
am2320 base driver function

am2320 base driver modules More...

Collaboration diagram for am2320 base driver function:

Data Structures

struct  am2320_handle_s
 am2320 handle structure definition More...
struct  am2320_info_s
 am2320 info structure definition More...

Typedefs

typedef struct am2320_handle_s am2320_handle_t
 am2320 handle structure definition
typedef struct am2320_info_s am2320_info_t
 am2320 info structure definition

Enumerations

enum  am2320_interface_t { AM2320_INTERFACE_IIC = 0x00 , AM2320_INTERFACE_GPIO = 0x01 }
 am2320 interface enumeration definition More...

Functions

uint8_t am2320_info (am2320_info_t *info)
 get chip's information
uint8_t am2320_set_interface (am2320_handle_t *handle, am2320_interface_t interface)
 set the chip interface
uint8_t am2320_get_interface (am2320_handle_t *handle, am2320_interface_t *interface)
 get the chip interface
uint8_t am2320_init (am2320_handle_t *handle)
 initialize the chip
uint8_t am2320_deinit (am2320_handle_t *handle)
 close the chip
uint8_t am2320_read_temperature_humidity (am2320_handle_t *handle, uint16_t *temperature_raw, float *temperature_s, uint16_t *humidity_raw, float *humidity_s)
 read the temperature and humidity data
uint8_t am2320_read_humidity (am2320_handle_t *handle, uint16_t *raw, float *s)
 read the humidity data
uint8_t am2320_read_temperature (am2320_handle_t *handle, uint16_t *raw, float *s)
 read the temperature data
uint8_t am2320_get_device_type (am2320_handle_t *handle, uint16_t *type)
 get device type
uint8_t am2320_get_version (am2320_handle_t *handle, uint8_t *version)
 get version
uint8_t am2320_get_status (am2320_handle_t *handle, uint8_t *status)
 get status
uint8_t am2320_get_device_id (am2320_handle_t *handle, uint32_t *id)
 get device id
uint8_t am2320_set_user_reg1 (am2320_handle_t *handle, uint16_t reg)
 set user reg1
uint8_t am2320_get_user_reg1 (am2320_handle_t *handle, uint16_t *reg)
 get user reg1
uint8_t am2320_set_user_reg2 (am2320_handle_t *handle, uint16_t reg)
 set user reg2
uint8_t am2320_get_user_reg2 (am2320_handle_t *handle, uint16_t *reg)
 get user reg2

Detailed Description

am2320 base driver modules

Typedef Documentation

◆ am2320_handle_t

am2320 handle structure definition

◆ am2320_info_t

typedef struct am2320_info_s am2320_info_t

am2320 info structure definition

Enumeration Type Documentation

◆ am2320_interface_t

am2320 interface enumeration definition

Enumerator
AM2320_INTERFACE_IIC 

iic interface

AM2320_INTERFACE_GPIO 

gpio interface

Definition at line 62 of file driver_am2320.h.

Function Documentation

◆ am2320_deinit()

uint8_t am2320_deinit ( am2320_handle_t * handle)

close the chip

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

Definition at line 1555 of file driver_am2320.c.

◆ am2320_get_device_id()

uint8_t am2320_get_device_id ( am2320_handle_t * handle,
uint32_t * id )

get device id

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*idpointer to an id buffer
Returns
status code
  • 0 success
  • 1 get device id failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 1022 of file driver_am2320.c.

◆ am2320_get_device_type()

uint8_t am2320_get_device_type ( am2320_handle_t * handle,
uint16_t * type )

get device type

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*typepointer to a type buffer
Returns
status code
  • 0 success
  • 1 get device type failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 788 of file driver_am2320.c.

◆ am2320_get_interface()

uint8_t am2320_get_interface ( am2320_handle_t * handle,
am2320_interface_t * interface )

get the chip interface

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

Definition at line 377 of file driver_am2320.c.

◆ am2320_get_status()

uint8_t am2320_get_status ( am2320_handle_t * handle,
uint8_t * status )

get status

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

Definition at line 944 of file driver_am2320.c.

◆ am2320_get_user_reg1()

uint8_t am2320_get_user_reg1 ( am2320_handle_t * handle,
uint16_t * reg )

get user reg1

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*regpointer to a reg buffer
Returns
status code
  • 0 success
  • 1 get user reg1 failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 1189 of file driver_am2320.c.

◆ am2320_get_user_reg2()

uint8_t am2320_get_user_reg2 ( am2320_handle_t * handle,
uint16_t * reg )

get user reg2

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*regpointer to a reg buffer
Returns
status code
  • 0 success
  • 1 get user reg2 failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 1355 of file driver_am2320.c.

◆ am2320_get_version()

uint8_t am2320_get_version ( am2320_handle_t * handle,
uint8_t * version )

get version

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*versionpointer to a version buffer
Returns
status code
  • 0 success
  • 1 get version failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 866 of file driver_am2320.c.

◆ am2320_info()

uint8_t am2320_info ( am2320_info_t * info)

get chip's information

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

Definition at line 1652 of file driver_am2320.c.

◆ am2320_init()

uint8_t am2320_init ( am2320_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an am2320 handle structure
Returns
status code
  • 0 success
  • 1 bus initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset failed
Note
none

Definition at line 1432 of file driver_am2320.c.

◆ am2320_read_humidity()

uint8_t am2320_read_humidity ( am2320_handle_t * handle,
uint16_t * raw,
float * s )

read the humidity data

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*rawpointer to a raw humidity buffer
[out]*spointer to a converted humidity buffer
Returns
status code
  • 0 success
  • 1 read humidity failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 401 of file driver_am2320.c.

◆ am2320_read_temperature()

uint8_t am2320_read_temperature ( am2320_handle_t * handle,
uint16_t * raw,
float * s )

read the temperature data

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*rawpointer to a raw temperature buffer
[out]*spointer to a converted temperature buffer
Returns
status code
  • 0 success
  • 1 read temperature failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 655 of file driver_am2320.c.

◆ am2320_read_temperature_humidity()

uint8_t am2320_read_temperature_humidity ( am2320_handle_t * handle,
uint16_t * temperature_raw,
float * temperature_s,
uint16_t * humidity_raw,
float * humidity_s )

read the temperature and humidity data

Parameters
[in]*handlepointer to an am2320 handle structure
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_spointer to a converted temperature buffer
[out]*humidity_rawpointer to a raw humidity buffer
[out]*humidity_spointer to a converted humidity buffer
Returns
status code
  • 0 success
  • 1 read temperature humidity failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 518 of file driver_am2320.c.

◆ am2320_set_interface()

uint8_t am2320_set_interface ( am2320_handle_t * handle,
am2320_interface_t interface )

set the chip interface

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

Definition at line 356 of file driver_am2320.c.

◆ am2320_set_user_reg1()

uint8_t am2320_set_user_reg1 ( am2320_handle_t * handle,
uint16_t reg )

set user reg1

Parameters
[in]*handlepointer to an am2320 handle structure
[in]regregister address
Returns
status code
  • 0 success
  • 1 set user reg1 failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 1101 of file driver_am2320.c.

◆ am2320_set_user_reg2()

uint8_t am2320_set_user_reg2 ( am2320_handle_t * handle,
uint16_t reg )

set user reg2

Parameters
[in]*handlepointer to an am2320 handle structure
[in]regregister address
Returns
status code
  • 0 success
  • 1 set user reg2 failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 gpio can't use this function
Note
only iic can use this function

Definition at line 1267 of file driver_am2320.c.