diff options
-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_ |