Skip to content
Permalink
Browse files

sensors: ti_hdc now supports 1050 versions

TI_HDC Driver now also supports the 1050 (e.g. hdc1050, hdc1080) temp/rh
sensor versions.

Signed-off-by: Nikos Oikonomou <nikoikonomou92@gmail.com>
  • Loading branch information...
nikooiko authored and MaureenHelm committed Jun 5, 2019
1 parent 080e71c commit e7dbc1d770d7fc9abd4e9a66b23e026c5ae60aca
Showing with 7 additions and 4 deletions.
  1. +5 −3 drivers/sensor/ti_hdc/ti_hdc.c
  2. +2 −1 drivers/sensor/ti_hdc/ti_hdc.h
@@ -117,6 +117,7 @@ static u16_t read16(struct device *dev, u8_t a, u8_t d)
static int ti_hdc_init(struct device *dev)
{
struct ti_hdc_data *drv_data = dev->driver_data;
u16_t tmp;

drv_data->i2c = device_get_binding(DT_TI_HDC_0_BUS_NAME);

@@ -131,9 +132,10 @@ static int ti_hdc_init(struct device *dev)
LOG_ERR("Failed to get correct manufacturer ID");
return -EINVAL;
}
if (read16(drv_data->i2c, DT_TI_HDC_0_BASE_ADDRESS,
TI_HDC_REG_DEVICEID) != TI_HDC_DEVICEID) {
LOG_ERR("Failed to get correct device ID");
tmp = read16(drv_data->i2c, DT_TI_HDC_0_BASE_ADDRESS,
TI_HDC_REG_DEVICEID);
if (tmp != TI_HDC1000_DEVID && tmp != TI_HDC1050_DEVID) {
LOG_ERR("Unsupported device ID");
return -EINVAL;
}

@@ -15,7 +15,8 @@
#define TI_HDC_REG_DEVICEID 0xFF

#define TI_HDC_MANUFID 0x5449
#define TI_HDC_DEVICEID 0x1000
#define TI_HDC1050_DEVID 0x1050
#define TI_HDC1000_DEVID 0x1000

/* For 14bit conversion RH needs 6.5ms and Temp 6.35ms */
#define HDC_CONVERSION_TIME 13

0 comments on commit e7dbc1d

Please sign in to comment.
You can’t perform that action at this time.