LibDriver AHT25
Loading...
Searching...
No Matches
driver_aht25.h
Go to the documentation of this file.
1
36
37#ifndef DRIVER_AHT25_H
38#define DRIVER_AHT25_H
39
40#include <stdio.h>
41#include <stdint.h>
42#include <string.h>
43
44#ifdef __cplusplus
45extern "C"{
46#endif
47
53
58
62typedef struct aht25_handle_s
63{
64 uint8_t (*iic_init)(void);
65 uint8_t (*iic_deinit)(void);
66 uint8_t (*iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len);
67 uint8_t (*iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len);
68 void (*delay_ms)(uint32_t ms);
69 void (*debug_print)(const char *const fmt, ...);
70 uint8_t inited;
72
88
92
99
106#define DRIVER_AHT25_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
107
114#define DRIVER_AHT25_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
115
122#define DRIVER_AHT25_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
123
130#define DRIVER_AHT25_LINK_IIC_READ_CMD(HANDLE, FUC) (HANDLE)->iic_read_cmd = FUC
131
138#define DRIVER_AHT25_LINK_IIC_WRITE_CMD(HANDLE, FUC) (HANDLE)->iic_write_cmd = FUC
139
146#define DRIVER_AHT25_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
147
154#define DRIVER_AHT25_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
155
159
166
175uint8_t aht25_info(aht25_info_t *info);
176
189uint8_t aht25_init(aht25_handle_t *handle);
190
201uint8_t aht25_deinit(aht25_handle_t *handle);
202
219uint8_t aht25_read_temperature_humidity(aht25_handle_t *handle, uint32_t *temperature_raw, float *temperature_s,
220 uint32_t *humidity_raw, uint8_t *humidity_s);
221
236uint8_t aht25_read_temperature(aht25_handle_t *handle, uint32_t *temperature_raw, float *temperature_s);
237
252uint8_t aht25_read_humidity(aht25_handle_t *handle, uint32_t *humidity_raw, uint8_t *humidity_s);
253
257
264
277uint8_t aht25_set_reg(aht25_handle_t *handle, uint8_t *buf, uint16_t len);
278
291uint8_t aht25_get_reg(aht25_handle_t *handle, uint8_t *buf, uint16_t len);
292
296
300
301#ifdef __cplusplus
302}
303#endif
304
305#endif
uint8_t aht25_info(aht25_info_t *info)
get chip's information
struct aht25_info_s aht25_info_t
aht25 information structure definition
uint8_t aht25_init(aht25_handle_t *handle)
initialize the chip
uint8_t aht25_read_temperature_humidity(aht25_handle_t *handle, uint32_t *temperature_raw, float *temperature_s, uint32_t *humidity_raw, uint8_t *humidity_s)
read the temperature and humidity data
uint8_t aht25_deinit(aht25_handle_t *handle)
close the chip
uint8_t aht25_read_humidity(aht25_handle_t *handle, uint32_t *humidity_raw, uint8_t *humidity_s)
read the humidity data
struct aht25_handle_s aht25_handle_t
aht25 handle structure definition
uint8_t aht25_read_temperature(aht25_handle_t *handle, uint32_t *temperature_raw, float *temperature_s)
read the temperature
uint8_t aht25_get_reg(aht25_handle_t *handle, uint8_t *buf, uint16_t len)
get the chip register
uint8_t aht25_set_reg(aht25_handle_t *handle, uint8_t *buf, uint16_t len)
set the chip register
aht25 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_read_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
uint8_t(* iic_write_cmd)(uint8_t addr, uint8_t *buf, uint16_t len)
aht25 information structure definition
float temperature_max
float supply_voltage_max_v
uint32_t driver_version
float temperature_min
float max_current_ma
char manufacturer_name[32]
float supply_voltage_min_v
char interface[8]
char chip_name[32]