Nelson Santos / Mbed 2 deprecated trabalho

Dependencies:   X_NUCLEO_IKS01A1-f255a2c75ecb mbed-rtos mbed

Committer:
Jacinta
Date:
Sat May 14 13:58:57 2016 +0000
Revision:
2:0b8065489409
Parent:
0:1eaebb55408a
Child:
3:1f17245afc88
File has been splitted (if there are things missing just tell me something).; Only thing I couldn't figure on to do was passing functions to threads which need arguments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jacinta 0:1eaebb55408a 1 #include "userMethods.h"
Jacinta 0:1eaebb55408a 2 #include "sensor.h"
Jacinta 0:1eaebb55408a 3 #include <cstring>
Jacinta 0:1eaebb55408a 4 #include <ctime>
Jacinta 0:1eaebb55408a 5 #include <stdexcept>
Jacinta 2:0b8065489409 6 #include <vector>
Jacinta 0:1eaebb55408a 7
Jacinta 2:0b8065489409 8 void UserMethods::readAllData(vector<log_data>& v) {
Jacinta 2:0b8065489409 9 printf("Entered in readAllData");
Jacinta 2:0b8065489409 10 //TODO Serial not working
Jacinta 2:0b8065489409 11 //Serial pc(USBTX, USBRX);
Jacinta 2:0b8065489409 12 //pc.baud(115200); //For fast sampling rates
Jacinta 2:0b8065489409 13 char buffer[32];
Jacinta 2:0b8065489409 14
Jacinta 2:0b8065489409 15 //.csv header
Jacinta 2:0b8065489409 16 printf("Sample_Date,HTS221_Temp,LPS25H_Press,HTS221_Hum\n\r");
Jacinta 2:0b8065489409 17 for(int i = 0; i < v.size(); i++)
Jacinta 2:0b8065489409 18 //TODO Add time here and read n
Jacinta 2:0b8065489409 19 //.csv friendly format for logging
Jacinta 2:0b8065489409 20 printf("%s,%7s°C,%smbar,%s%%\n\r", ctime(&v[i].date), ExpansionBoard::printDouble(buffer, v[i].tempCelsius, 2),
Jacinta 2:0b8065489409 21 ExpansionBoard::printDouble(buffer, v[i].pressure, 2), ExpansionBoard::printDouble(buffer, v[i].humidity, 2));
Jacinta 0:1eaebb55408a 22 }
Jacinta 0:1eaebb55408a 23
Jacinta 2:0b8065489409 24 void UserMethods::readNData(vector<log_data>& v, int &n) {
Jacinta 2:0b8065489409 25 //Serial pc(USBTX, USBRX);
Jacinta 2:0b8065489409 26 //pc.baud(115200);
Jacinta 2:0b8065489409 27 printf("Sample_Date,HTS221_Temp,LPS25H_Press,HTS221_Hum\n\r");
Jacinta 2:0b8065489409 28 char buffer[32];
Jacinta 2:0b8065489409 29 for(int i = v.size()-n-1; i < v.size(); i++)
Jacinta 2:0b8065489409 30 printf("%s,%7s°C,%smbar,%s%%\n\r", ctime(&v[i].date), ExpansionBoard::printDouble(buffer, v[i].tempCelsius, 2),
Jacinta 2:0b8065489409 31 ExpansionBoard::printDouble(buffer, v[i].pressure, 2), ExpansionBoard::printDouble(buffer, v[i].humidity, 2));
Jacinta 0:1eaebb55408a 32 }
Jacinta 0:1eaebb55408a 33
Jacinta 2:0b8065489409 34 void UserMethods::logging(const void*) { return; }