Github Repo | C Header | C source | JS source |
---|---|---|---|
mongoose-os-libs/tmp006 | mgos_tmp006.h | api_tmp006.js |
This is a library for the Texas Instruments TMP006 temperature sensor. See http://www.ti.com/product/TMP006 for more information about the hardware.
bool mgos_tmp006_setup(struct mgos_i2c *bus, uint8_t addr,
enum tmp006_conversion_rate rate, bool drdy_en);
Initialize TMP006 driver on the given I2C
bus
andaddr
, with the given conversion rate (seeenum tmp006_conversion_rate
). To enableDRDY
pin, setdrdy_en
totrue
.Returns
true
in case of success,false
otherwise.
double mgos_tmp006_get_voltage(struct mgos_i2c *i2c, uint8_t addr);
Get voltage from the TMP006 sensor at the given i2c bus and addr. In case of failure, returns
TMP006_INVALID_READING
.
double mgos_tmp006_get_die_temp(struct mgos_i2c *i2c, uint8_t addr);
Get temperature in C degrees from the TMP006 sensor at the given i2c bus and addr. In case of failure, returns
TMP006_INVALID_READING
.