Algoritmo funcionando com a biblioteca de inatividade utilizando dos dados do acelerômetro e a biblioteca de PeakSearch se utilizando dos dados filtrados pelo filtro Kalman.

Dependencies:   mbed MatrixMath Matrix nrf51_rtc BMP180 MPU9250

Revision:
0:095b19b8fb7e
diff -r 000000000000 -r 095b19b8fb7e file_comands.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/file_comands.h	Thu Mar 07 23:30:19 2019 +0000
@@ -0,0 +1,62 @@
+#ifndef FILE_UTIL_H
+#define FILE_UTIL_H
+ 
+#include "mbed.h"
+
+void    file_name_txt() 
+//Limite 22 char, 18 com .txt
+{  
+    time_t rawtime=rtc.time();
+
+    // massage the time into a human-friendly format for printing
+    struct tm * timeinfo;
+    timeinfo = localtime(&rawtime);
+    char date[24];
+    char buffn[50];
+    //char paciente[50];
+    //sprintf(paciente,"Paciente"); //maximo 9 caracteres
+
+    strftime(date,sizeof(date),"-%d-%m-%g",timeinfo);
+    sprintf(buffn, "append ");
+    sprintf(buffn + strlen(buffn),paciente);
+    sprintf(buffn + strlen(buffn),date);
+    sprintf(buffn + strlen(buffn),".txt\r");
+    Open.printf(buffn);
+    
+} // end file_name_txt()
+
+void new_file() 
+{
+    Open.putc(36);
+    Open.putc(36);
+    Open.putc(36);
+
+    while (1)
+    {
+        if(Open.readable())
+        if(char(Open.getc() == '>')) break;
+    
+    } //end While(1)
+    
+    file_name_txt();
+
+    //Wait for file to be open and ready
+    while(1) 
+    {
+        if(Open.readable())
+        if(char(Open.getc() == '<')) 
+        {
+           // Open.printf("Acelerometro x,y,z (m/s^2), Giroscopio x,y,z (deg/s), Magnetometro x,y,z (mG),  Altura(m), Temperatura (C), hora, data, frame \r\n");
+           Open.printf("Mare V0  -- Roger Censon \r\n");
+           Open.printf("Paciente: ");
+           Open.printf(paciente);
+           Open.printf("\r\n");
+           print_time();
+           Open.printf("Contagem de passos \r\n");
+            break;
+        }
+        
+    }  //end while(1)
+}// end new_file() 
+
+#endif