Files
mgos_i2c_mock/include/mgos_sht31.h
Pim van Pelt b1d92a32a8 Include first driver: SHT31
Make I2C reads blocking w/ timeout
Add SHT31 driver, roughly :)
Fix mg_time() to return a double.
2018-04-02 17:29:13 +02:00

58 lines
721 B
C

#pragma once
#include "mgos.h"
#include "mgos_i2c.h"
#define MGOS_SHT31_READ_DELAY (2)
#ifdef __cplusplus
extern "C" {
#endif
struct mgos_sht31;
/*
*
*/
struct mgos_sht31 *mgos_sht31_create(struct mgos_i2c *i2c, uint8_t i2caddr);
/*
*
*/
void mgos_sht31_destroy(struct mgos_sht31 **sensor);
/*
*
*/
bool mgos_sht31_read(struct mgos_sht31 *sensor);
/*
*
*/
void mgos_sht31_setHeater(struct mgos_sht31 *sensor, bool enabled);
/*
*
*/
float mgos_sht31_getTemperature(struct mgos_sht31 *sensor);
/*
*
*/
float mgos_sht31_getHumidity(struct mgos_sht31 *sensor);
/*
*
*/
uint16_t mgos_sht31_getStatus(struct mgos_sht31 *sensor);
/*
*
*/
bool mgos_sht31_i2c_init(void);
#ifdef __cplusplus
}
#endif