TMP117 from TI is a sensor similar to tmp116, but it has more precision
and it also supports the offset register.
Add support for SENSOR_ATTR_OFFSET, which is used by TMP117 to the
pre-exisiting tmp116 driver.
This commit also enables multiple instances and adds TMP117 to Kconfig.
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
- Added support for TMP117 in existing driver for TMP116
The Texas Instruments TMP117 is a higher precision upgrade
from TMP116. It shares most functionality, but has a
differing device ID.
This patch will run with the hardware IDs of both devices.
- Fixed an int promote issue in tmp116_channel_get
Negative temperature values in drv_data->sample were not
processed correctly.
The error occured during integer promotion from u16_t to s32_t
in this code line:
tmp = (s32_t)drv_data->sample * TMP116_RESOLUTION;
By first promoting to s16_t, the correct result is obtained:
tmp = (s16_t)drv_data->sample * (s32_t)TMP116_RESOLUTION;
- Made temperature resolution compatible to sensor API
The fractional part of the temperature was returned as a
multiple of 10^-7 deg.Celsius.
This differs from the resolution sugegsted by the sensor API,
which is 10^-6.
The driver is now returning temperature readings with
a resolution of 10^-6 deg. Celsius.
- The changed driver was tested using following hardware:
TMP117 attached to disco_l475_iot1 via i2c1
Signed-off-by: Hans Wilmers <hans@wilmers.no>