diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2019-05-01 09:36:10 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2019-05-01 09:36:10 -0400 |
commit | 4f8b7f39f5d404a076142b1f62c85eb09df9061d (patch) | |
tree | 88fd0fa2c11abc5d10763895bf8914787cadba5c | |
parent | fa8974a5dd710e8352ebde9ade6b9d22eb98b96c (diff) |
show object voltage
-rwxr-xr-x | main.c | 5 | ||||
-rwxr-xr-x | temp.c | 5 | ||||
-rwxr-xr-x | temp.h | 11 |
3 files changed, 19 insertions, 2 deletions
@@ -41,11 +41,12 @@ int main(void) while (1); } - char buf[8]; + char buf[32]; while (1) { lcdClear(); int16_t temp = tempGetDieTemperature(); - sprintf(buf, "%04d", temp); + int16_t vobj = tempGetObjVoltage(); + sprintf(buf, "T: %4d V: %4d", temp, vobj); lcdPuts(buf); delay(1000); } @@ -69,6 +69,11 @@ int16_t tempGetDieTemperature(void) return (raw >> 2) / 32; } +int16_t tempGetObjVoltage(void) +{ + return tempI2CRead(TMP006_VOBJ); +} + void tempI2CWrite(uint8_t reg, uint16_t value) { uint8_t data[3] = { @@ -27,6 +27,17 @@ */ int tempInit(void); +/** + * Gets the object's voltage, which may be used in calculations to get the + * object's temperature. + * @return The object's voltage + */ +int16_t tempGetObjVoltage(void); + +/** + * Gets the current ambient temperature, in Celsius. + * @return The ambient temperature + */ int16_t tempGetDieTemperature(void); #endif // TEMP_H_ |