Add skeleton for HTU21DF driver
This commit is contained in:
31
src/mgos_htu21df_internal.h
Normal file
31
src/mgos_htu21df_internal.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "mgos.h"
|
||||
#include "mgos_i2c.h"
|
||||
#include "mgos_htu21df.h"
|
||||
#include <math.h>
|
||||
|
||||
#define MGOS_HTU21DF_DEFAULT_I2CADDR (0x40)
|
||||
|
||||
#define MGOS_HTU21DF_READTEMP (0xE3)
|
||||
#define MGOS_HTU21DF_READHUM (0xE5)
|
||||
#define MGOS_HTU21DF_WRITEREG (0xE6)
|
||||
#define MGOS_HTU21DF_READREG (0xE7)
|
||||
#define MGOS_HTU21DF_RESET (0xFE)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mgos_htu21df {
|
||||
struct mgos_i2c *i2c;
|
||||
uint8_t i2caddr;
|
||||
double last_read_time;
|
||||
|
||||
float humidity, temperature;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user