42 lines
768 B
C
42 lines
768 B
C
#ifndef AHT10_H
|
|
#define AHT10_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define AHT10_SKIP_BUSY_CHECK
|
|
|
|
typedef enum {
|
|
AHT10_OK,
|
|
AHT10_FAIL,
|
|
} aht10_ret_t;
|
|
|
|
typedef struct {
|
|
uint8_t *tx_data;
|
|
uint8_t *rx_data;
|
|
uint16_t tx_size;
|
|
uint16_t rx_size;
|
|
} aht10_xfer_desc_t;
|
|
|
|
typedef aht10_ret_t (*aht10_i2c_xfer_t)(void *pdev, aht10_xfer_desc_t *xfer);
|
|
typedef aht10_ret_t (*aht10_delay_t)(void *pdev, uint32_t delay_msec);
|
|
|
|
typedef struct {
|
|
double temperature;
|
|
double humidity;
|
|
} aht10_result_t;
|
|
|
|
typedef struct {
|
|
aht10_i2c_xfer_t xfer;
|
|
aht10_delay_t delay;
|
|
} aht10_cb_t;
|
|
|
|
typedef struct {
|
|
aht10_cb_t cb;
|
|
void *user_data;
|
|
} aht10_t;
|
|
|
|
aht10_ret_t aht10_init(aht10_t *aht);
|
|
aht10_ret_t aht10_measure(aht10_t *aht, aht10_result_t *result);
|
|
|
|
|
|
#endif |