42#include "lib/sensors.h"
44static uint8_t enabled;
47configure(
int type,
int value)
49 if(type != SENSORS_ACTIVE) {
73sht25_read_reg(uint8_t reg)
75 uint8_t buf[] = { 0x00, 0x00 };
80 i2c_transmitinit(SHT25_ADDR);
82 i2c_transmit_n(1, &rtx);
85 i2c_receiveinit(SHT25_ADDR);
87 i2c_receive_n(2, &buf[0]);
90 retval = (uint16_t)(buf[0] << 8 | (buf[1]));
95sht25_convert(uint8_t variable, uint16_t value)
99 buff = (uint32_t)value;
100 if(variable == SHT25_VAL_TEMP) {
103 rd = (int16_t)buff - 4685;
107 rd = (int16_t)buff - 600;
108 rd = (rd > 10000) ? 10000 : rd;
114sht25_read(uint8_t variable)
119 if((variable != SHT25_VAL_TEMP) && (variable != SHT25_VAL_HUM)) {
122 raw = sht25_read_reg(variable);
123 rd = sht25_convert(variable, raw);
130 return sht25_read(type);
133SENSORS_SENSOR(sht25, SHT25_SENSOR, value, configure, status);
I2C communication device driver header file for Zolertia Z1 sensor node.