30 lines
624 B
C
30 lines
624 B
C
#ifndef HTU21D_H
|
|
#define HTU21D_H
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
HTU21D_OK,
|
|
HTU21D_ERROR
|
|
} htu21d_ret_t;
|
|
|
|
typedef struct {
|
|
htu21d_ret_t (*write_cb)(void * handle, uint8_t* data, uint8_t len);
|
|
htu21d_ret_t (*read_cb)(void *handle, uint8_t* data, uint8_t len);
|
|
htu21d_ret_t (*delay_cb)(void *handle, uint32_t msec);
|
|
} htu21d_cb_t;
|
|
|
|
typedef struct {
|
|
float temperature;
|
|
float humidity;
|
|
} htu21d_result_t;
|
|
|
|
typedef struct {
|
|
htu21d_cb_t cb;
|
|
void *user_data;
|
|
} htu21d_t;
|
|
|
|
htu21d_ret_t htu21d_init(htu21d_t *htu);
|
|
htu21d_ret_t htu21d_measure(htu21d_t *htu, htu21d_result_t *result);
|
|
|
|
#endif |