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

file_comands.h

Committer:
Rogercl
Date:
2019-08-04
Revision:
6:e9a2bc040ada
Parent:
0:095b19b8fb7e

File content as of revision 6:e9a2bc040ada:

#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