37#ifndef DRIVER_AM2320_H
38#define DRIVER_AM2320_H
123#define DRIVER_AM2320_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
131#define DRIVER_AM2320_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
139#define DRIVER_AM2320_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
147#define DRIVER_AM2320_LINK_IIC_WRITE_COMMAND(HANDLE, FUC) (HANDLE)->iic_write_cmd = FUC
155#define DRIVER_AM2320_LINK_IIC_READ_COMMAND(HANDLE, FUC) (HANDLE)->iic_read_cmd = FUC
163#define DRIVER_AM2320_LINK_BUS_INIT(HANDLE, FUC) (HANDLE)->bus_init = FUC
171#define DRIVER_AM2320_LINK_BUS_DEINIT(HANDLE, FUC) (HANDLE)->bus_deinit = FUC
179#define DRIVER_AM2320_LINK_BUS_READ(HANDLE, FUC) (HANDLE)->bus_read = FUC
187#define DRIVER_AM2320_LINK_BUS_WRITE(HANDLE, FUC) (HANDLE)->bus_write = FUC
195#define DRIVER_AM2320_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
203#define DRIVER_AM2320_LINK_DELAY_US(HANDLE, FUC) (HANDLE)->delay_us = FUC
211#define DRIVER_AM2320_LINK_ENABLE_IRQ(HANDLE, FUC) (HANDLE)->enable_irq = FUC
219#define DRIVER_AM2320_LINK_DISABLE_IRQ(HANDLE, FUC) (HANDLE)->disable_irq = FUC
227#define DRIVER_AM2320_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t am2320_set_user_reg1(am2320_handle_t *handle, uint16_t reg)
set user reg1
uint8_t am2320_get_version(am2320_handle_t *handle, uint8_t *version)
get version
uint8_t am2320_get_device_type(am2320_handle_t *handle, uint16_t *type)
get device type
struct am2320_handle_s am2320_handle_t
am2320 handle structure definition
uint8_t am2320_init(am2320_handle_t *handle)
initialize the chip
uint8_t am2320_get_interface(am2320_handle_t *handle, am2320_interface_t *interface)
get the chip interface
uint8_t am2320_read_temperature(am2320_handle_t *handle, uint16_t *raw, float *s)
read the temperature data
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
am2320_interface_t
am2320 interface enumeration definition
uint8_t am2320_set_user_reg2(am2320_handle_t *handle, uint16_t reg)
set user reg2
uint8_t am2320_get_device_id(am2320_handle_t *handle, uint32_t *id)
get device id
uint8_t am2320_get_status(am2320_handle_t *handle, uint8_t *status)
get status
uint8_t am2320_get_user_reg1(am2320_handle_t *handle, uint16_t *reg)
get user reg1
uint8_t am2320_read_humidity(am2320_handle_t *handle, uint16_t *raw, float *s)
read the humidity data
uint8_t am2320_deinit(am2320_handle_t *handle)
close the chip
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
struct am2320_info_s am2320_info_t
am2320 info structure definition
uint8_t am2320_get_user_reg2(am2320_handle_t *handle, uint16_t *reg)
get user reg2
uint8_t am2320_set_get_reg(am2320_handle_t *handle, uint8_t *input_buf, uint16_t input_len, uint8_t *output_buf, uint16_t output_len)
set and get the register value
am2320 handle structure definition
uint8_t(* bus_deinit)(void)
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
void(* delay_us)(uint32_t us)
void(* disable_irq)(void)
uint8_t(* bus_read)(uint8_t *value)
uint8_t(* bus_write)(uint8_t value)
uint8_t(* iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
uint8_t(* bus_init)(void)
uint8_t(* iic_deinit)(void)
uint8_t(* iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
am2320 info structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v