Code clean up and handling FIFO errors

Files at this revision

API Documentation at this revision

Comitter:
Vkadaba
Date:
Mon Apr 20 06:23:42 2020 +0000
Parent:
68:9cecd6f955c8
Commit message:
Break if FIFO error is read

Changed in this revision

common/utils.c Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 9cecd6f955c8 -r 4305ac772a66 common/utils.c
--- a/common/utils.c	Mon Apr 20 05:46:42 2020 +0000
+++ b/common/utils.c	Mon Apr 20 06:23:42 2020 +0000
@@ -260,13 +260,17 @@
          * Wait until the next batch of 1 or more samples is ready, continuously
          * checking DATAREADY until it is asserted
          */
-    //Checking the status of the device before capturing the data 
+    //Checking if FIFO error is set 
     res = admw_GetStatus(hDevice, &status);
     if (res != ADMW_SUCCESS) 
     {
         ADMW_LOG_ERROR("Failed to retrieve device status");
     }
-    utils_printStatus(&status);
+    if (status.deviceStatus & ADMW_DEVICE_STATUS_FIFO_ERROR)
+    {
+        utils_printStatus(&status);
+        break;
+    }
         while (! (bDataReady || bError));
 
             if (!bError) {
diff -r 9cecd6f955c8 -r 4305ac772a66 main.cpp
--- a/main.cpp	Mon Apr 20 05:46:42 2020 +0000
+++ b/main.cpp	Mon Apr 20 06:23:42 2020 +0000
@@ -63,7 +63,7 @@
 extern ADMW_CONFIG measureware_config;
 
 /* Change the following pointer to load or change the configurations  */
-static ADMW_CONFIG *pSelectedConfig = &thermocouple_typeK_cjc0_config;
+static ADMW_CONFIG *pSelectedConfig = &i2c0_sensirionSHT3X_config;
 
 /* use the following to load LUT */
 extern ADMW1001_LUT_DESCRIPTOR *lut_desc_list[];