]> code.bitgloo.com Git - clyne/msp430-temp-lcd.git/commitdiff
show object voltage
authorClyne Sullivan <tullivan99@gmail.com>
Wed, 1 May 2019 13:36:10 +0000 (09:36 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Wed, 1 May 2019 13:36:10 +0000 (09:36 -0400)
main.c
temp.c
temp.h

diff --git a/main.c b/main.c
index 3cab384c217faac9ec31ec08f740d90e011e5f97..5e678c2b7f6ef5c70f2cdcfe7332e434a55eb3cf 100755 (executable)
--- a/main.c
+++ b/main.c
@@ -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);
        }
diff --git a/temp.c b/temp.c
index e094d6f45592f52db3ab96883d9484ce6d1fb3f9..e617a58299a7219314a2023aeaf52dd43ba2453a 100755 (executable)
--- a/temp.c
+++ b/temp.c
@@ -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] = {
diff --git a/temp.h b/temp.h
index aec66c9b86141bda4f190dbb4f078db8ecc75d19..ab28b842c98abe5fd3ac50c2b03c52216f6d9c17 100755 (executable)
--- a/temp.h
+++ b/temp.h
  */
 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_