diff options
author | Vic Yang <victoryang@chromium.org> | 2012-02-15 15:38:06 -0800 |
---|---|---|
committer | Vic Yang <victoryang@chromium.org> | 2012-02-18 13:37:53 +0800 |
commit | 0fefd25c0c7d6517f47aac2da974495f72312014 (patch) | |
tree | d67e0071040aa53f3b3922f2ca39cce6ed4e4617 /include/temp_sensor.h | |
parent | 737fbbd032ef937b37f2e5e833fa52455aa19c64 (diff) | |
download | chrome-ec-0fefd25c0c7d6517f47aac2da974495f72312014.tar.gz |
Temperature polling and temporal correction
A temperature polling task is added to achieve temporal correction and
also reduce the latency of reading temperature.
Factor out sensor specific part to keep code clean.
Signed-off-by: Vic Yang <victoryang@chromium.org>
BUG=chrome-os-partner:7801
TEST=On link, 'temps' shows all temperature readings.
Cover each sensor with hand and see object temperature rise.
Compilation succeeded on bds/adv/daisy/discovery.
Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
Diffstat (limited to 'include/temp_sensor.h')
-rw-r--r-- | include/temp_sensor.h | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/include/temp_sensor.h b/include/temp_sensor.h index fb35260e12..b20c77fe88 100644 --- a/include/temp_sensor.h +++ b/include/temp_sensor.h @@ -16,24 +16,12 @@ enum temp_sensor_id; struct temp_sensor_t { const char* name; - /* Sensor address. Used by read and print functions. */ - int addr; /* Read sensor value and return temperature in K. */ - int (*read)(const struct temp_sensor_t* self); - /* Print debug info on console. */ - int (*print)(const struct temp_sensor_t* self); + int (*read)(int idx); + /* Index among the same kind of sensors. */ + int idx; }; -/* Dummy value to put in "addr" field in temp_sensor_t if we don't need to - * specify address. - */ -#define TEMP_SENSOR_NO_ADDR 0 - -/* Dummy value to put in "print" field in temp_sensor_t if we don't have debug - * function for a sensor. - */ -#define TEMP_SENSOR_NO_PRINT 0 - /* Initializes the module. */ int temp_sensor_init(void); @@ -41,21 +29,4 @@ int temp_sensor_init(void); * or -1 if error. */ int temp_sensor_read(enum temp_sensor_id id); - -#define TMP006_ADDR(PORT,REG) ((PORT << 16) + REG) -#define TMP006_PORT(ADDR) (ADDR >> 16) -#define TMP006_REG(ADDR) (ADDR & 0xffff) - -/* Read TI TMP006 die temperature sensor. Return temperature in K. */ -int temp_sensor_tmp006_read_die_temp(const struct temp_sensor_t* sensor); - -/* Read TI TMP006 object temperature sensor. Return temperature in K. */ -int temp_sensor_tmp006_read_object_temp(const struct temp_sensor_t* sensor); - -/* Configure TMP006 DRDY pin. */ -void temp_sensor_tmp006_config(const struct temp_sensor_t* sensor); - -/* Print debug messages for TMP006. */ -int temp_sensor_tmp006_print(const struct temp_sensor_t* sensor); - #endif /* __CROS_EC_TEMP_SENSOR_H */ |