Central Applications - Mbed Code repo / Mbed OS MAX30205_Demo

Dependencies:   MAX30205 max32630fthr

Fork of MAX30205_Demo by Corey Harris

Revision:
2:cf07a3eb2f30
Parent:
1:1cab60b84d7f
Child:
3:4a8ab8ffd52d
--- a/main.cpp	Wed Aug 16 22:59:14 2017 +0000
+++ b/main.cpp	Thu Aug 17 20:10:51 2017 +0000
@@ -6,7 +6,6 @@
 
 bool temp_sensor_config(MAX30205 &temp_sensor);
 
-
 int main()
 {
     
@@ -38,18 +37,18 @@
             if ( temp_sensor_sampleTimer.read() > 1.0 && !temp_conversion_flag){
                 
                 temp_cfg.bits.one_shot = 1;
-                rc = temp_sensor->writeConfiguration(temp_cfg);    
-                temp_conversion_flag = 1;
+                rc = temp_sensor->writeConfiguration(temp_cfg);     // Send one-shot cmd to begin conversion  
+                temp_conversion_flag = 1;                           // Raise flag indicating a conversion has begun
                 
             } 
             
             /* Read the completed temperature conversion */
             if ( temp_sensor_sampleTimer.read() > 1.05 && temp_conversion_flag ){
                 
-                temp_conversion_flag = 0;               
-                rc = temp_sensor->readTemperature(rawTemperatureRead); 
-                temperature = temp_sensor->toCelsius(rawTemperatureRead);
-                temp_sensor_sampleTimer.reset(); 
+                temp_conversion_flag = 0;                                   // Lower flag when conversion has completed
+                rc = temp_sensor->readTemperature(rawTemperatureRead);      // Read the temperature data
+                temperature = temp_sensor->toCelsius(rawTemperatureRead);   // Convert temp data to Celsius
+                temp_sensor_sampleTimer.reset();                            // Reset timer 
                 
                 pc.printf("Temperature is %2.3f deg. C \r\n", temperature);