Example host software for the Maxim Integrated MAX31723/MAX31722 Device Temperature Sensor. Hosted on the MAX32630FTHR. The MAX31723 may be used in thermostats, thermometers, and hardware temperature supervisors.

Dependencies:   MAX31723_Digital_Temperature_Sensor max32630fthr USBDevice

Revision:
13:052296efd9e3
Parent:
11:36f82087066e
Child:
14:a976a6a00f7f
--- a/main.cpp	Wed Jan 30 02:14:35 2019 +0000
+++ b/main.cpp	Tue Feb 12 22:57:39 2019 +0000
@@ -66,35 +66,49 @@
 
 int main()
 {
-    int ret, i;
+    int i, ret;
     float temperature;
-    uint8_t value;
     DigitalOut rLED(LED1, LED_OFF);
     DigitalOut gLED(LED2, LED_OFF);
     DigitalOut bLED(LED3, LED_OFF);
+    printf("MAX31723 Temperature Sensor example code.\r\n");
+    printf("\r\n");
     
     gLED = LED_ON;
 
-    MAX31723 max31723_temp(spi, selectPin);
+    MAX31723 temp_sensor(spi, selectPin);
     spi.format(8,3);  /* 8-bit, SPI mode 3 */
     spi.frequency(5000000);  /* Use 5 MHz SPI bus */
     /* Jumpers (JP1) on MAX31723PMB should be set to SPI mode configuration
      * or SERMODE pin should be set to VDD for SPI mode
      */
-    ret = max31723_temp.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
+    ret = temp_sensor.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
     
     for (i = 0; i < 5; i++) {
-        ret = max31723_temp.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
+        ret = temp_sensor.perform_one_shot_int(MAX31723_CFG_RESOLUTION_12BIT);
         wait(MAX31723_CONV_TIME_MSEC_12BIT);
-        temperature = max31723_temp.read_reg_as_temperature(MAX31723_REG_TEMP_LSB);
+        temperature = temp_sensor.read_temperature();
         printf("Temperature = %4.4f Celsius, %4.4f Fahrenheit\r\n", 
-            temperature, max31723_temp.celsius_to_fahrenheit(temperature));
+            temperature, temp_sensor.celsius_to_fahrenheit(temperature));
         wait(2);
     } 
-    printf("Configuration Register = 0x%02Xh \r\n", max31723_temp.read_cfg());
+    printf("Configuration Register = 0x%02Xh \r\n", temp_sensor.read_cfg());
 
     printf("\r\n");
 
+
+//    temp_sensor.write_trip_low(-25.0625f);
+    temperature = temp_sensor.read_trip_low();
+    printf("Tlow Temperature = %3.4f Celsius, %3.4f Fahrenheit\r\n", 
+            temperature, temp_sensor.celsius_to_fahrenheit(temperature));
+
+//    temp_sensor.write_trip_high(25.5625f);
+    temperature = temp_sensor.read_trip_high();
+    printf("Thigh Temperature = %3.4f Celsius, %3.4f Fahrenheit\r\n", 
+            temperature, temp_sensor.celsius_to_fahrenheit(temperature));
+    printf("\r\n\r\n");
+
+
     while (true) {  // Blink the green LED 
         gLED = !gLED;
         wait(1.0);