#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