ADMW1001_Mbed_FW / Mbed OS EV-PRO-MW1001_Development
Revision:
74:27a28f452d71
Parent:
73:cae0c514bea6
Child:
78:2301b7437902
--- a/common/utils.c	Fri Apr 24 11:51:13 2020 +0000
+++ b/common/utils.c	Fri Apr 24 12:04:28 2020 +0000
@@ -43,27 +43,6 @@
 
 #include "utils.h"
 #include "admw_log.h"
-#include "admw_spi.h"
-#include "admw1001/admw1001_api.h"
-#include "inc/nucleo_io.h"
-#include <stdio.h>
-
-void utils_runMeasurementsFromSerialPing(ADMW_DEVICE_HANDLE hDevice, ADMW_MEASUREMENT_MODE eMeasurementMode)
-{
-    int i_serialCheck = 0;
-    ADMW_RESULT result = ADMW_IN_USE;
-    while(true)
-    {
-        i_serialCheck = 0;
-        i_serialCheck = nucleo_in();
-
-        if(i_serialCheck == '=')
-        {
-            result = utils_runMeasurement(hDevice, eMeasurementMode);
-            i_serialCheck = 0;
-        }
-    }
-}
 
 void utils_printStatus(
     ADMW_STATUS *pStatus)
@@ -121,30 +100,13 @@
     }
 }
 
-char *rtrim(char *str, const char *seps)
-                                    
-                         
-                                           
+void utils_printSamples(
+    ADMW_DATA_SAMPLE *pSampleBuffer,
+    uint32_t nNumSamples,
+    ADMW_MEASUREMENT_MODE eMeasurementMode)
 {
-    int i;
-    if (seps == NULL) {
-        seps = "\t\n\v\f\r ";
-    }
-    i = strlen(str) - 1;
-    while (i >= 0 && strchr(seps, str[i]) != NULL) {
-        str[i] = '\0';
-        i--;
-    }
-    return str;
-}
-
-void utils_printSamples( ADMW_DATA_SAMPLE *pSampleBuffer, uint32_t nNumSamples, ADMW_MEASUREMENT_MODE eMeasurementMode)
-{
-    char *strbuilder = (char *)malloc((1000)*sizeof(char));
-    strbuilder[0] = '\0';
     for (uint32_t i = 0; i < nNumSamples; i++) {
-        int str_length = strlen(strbuilder);
-        sprintf(strbuilder+str_length, "Sample#%2dChannel#%2d:Raw%f:Processed%f:flags:%s%s\r\n",
+        ADMW_LOG_INFO("Sample # %2d Channel_ID # %2d :: Raw_Sample %f :: processedValue %f :: flags: ERROR:%X , ALERT:%X",
                       i+1,
                       pSampleBuffer[i].Channel_ID,
                       pSampleBuffer[i].Raw_Sample,
@@ -152,13 +114,8 @@
                       pSampleBuffer[i].Ch_Error,
                       pSampleBuffer[i].Ch_Alert);
     }
-    rtrim(strbuilder, NULL/* */);
-    NUCLEO_OUT("%s", strbuilder);
-    
-    free(strbuilder);
 }
 
-
 static void gpioCallbackFn(ADMW_GPIO_PIN ePinId, void * pArg)
 {
     volatile bool *pbFlag = (volatile bool *)pArg;