diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-10-10 14:32:38 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-10-11 10:06:54 -0700 |
commit | 0b6b6b7754359546d4fd6684156bc7b120328721 (patch) | |
tree | a4101c6611990f5409a51eb5b04e23a071798aa2 /include/tmp006.h | |
parent | 678e649240ed950b08bffa254e994e1f867673d0 (diff) | |
download | chrome-ec-0b6b6b7754359546d4fd6684156bc7b120328721.tar.gz |
Refactor TMP006 module
1) Use floating-point more freely, since it's on all the time now, and
the old fixed-point code no longer compiled.
2) Sensitivity and Bn values are now in a RAM-based struct in
preparation for setting them at runtime. No changes from current
values.
3) If a sensor fails to read good data, is initialized, or loses
power, its die temperature history will be set to the next good
temperature, rather than persisting an arbitrary start value or old
state. This fixes reading wildly inaccurate object temperatures for
the first few seconds following boot/resume.
4) If a sensor loses power, wait for the sensor to report data-ready
before reading temperature/voltage. Otherwise, those read as 0, which
again throws off the first few seconds of data.
BUG=chrome-os-partner:14955
BRANCH=link
TEST=Boot system and set at login screen for a minute to reach thermal
equilibrium. Then reboot system, type 'temps' repeatedly. Data from
TMP006's should initially be Error; after a second or so it should be
good, and shouldn't change more than a few degrees.
Change-Id: Id0b42b9b18e94978ba7d3a1ee33194e44b1904bc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35188
Diffstat (limited to 'include/tmp006.h')
-rw-r--r-- | include/tmp006.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/include/tmp006.h b/include/tmp006.h index 6d8b26857d..c1c4b21c24 100644 --- a/include/tmp006.h +++ b/include/tmp006.h @@ -14,19 +14,25 @@ struct tmp006_t { const char* name; - /* I2C address formed by TMP006_ADDR macro. */ - int addr; - /* Sensitivity factor, in 10^11. */ - int sens; + int addr; /* I2C address formed by TMP006_ADDR macro. */ + float S0; /* Sensitivity factor */ }; -/* Poll all TMP006 sensors. Return 0 on success. */ +/** + * Poll all TMP006 sensors. + * + * @return 0 if successful, non-zero if error. */ int tmp006_poll(void); -/* Get the last polled value of a sensor. Return temperature in K. - * The low bit in idx indicate whether to read die temperature or - * object temperature. The other bits serve as internal index to tmp006 - * module. */ +/** + * Get the last polled value of a sensor. + * + * @param idx Index to read. The low bit in idx indicates whether + * to read die temperature or object temperature. The + * other bits serve as internal index to tmp006 module. + * + * @return Temperature in K. + */ int tmp006_get_val(int idx); #endif /* __CROS_EC_TMP006_H */ |