
trabalho
Dependencies: X_NUCLEO_IKS01A1 mbed-rtos mbed
Fork of HelloWorld_IKS01A1 by
mailBox.cpp
- Committer:
- stwykd
- Date:
- 2016-05-08
- Revision:
- 26:71c54c8ae536
- Parent:
- 25:55c0dc5b32b3
- Child:
- 28:840000670c88
File content as of revision 26:71c54c8ae536:
#include "mbed.h" #include "rtos.h" #include <time.h> //#include <main.cpp> class MailBox{ public: typedef struct { uint8_t id; float tempCelcius; float tempFarenheit; float humidity; float pressure; int accelerometer; int gyroscope; int magnetometer; char* date; } log_data; Mail<log_data, 120> mail_box; void send_thread (log_data newLog) { while (true) { log_data *log = mail_box.alloc(); log->tempCelcius = newLog.tempCelcius; log->tempFarenheit = newLog.tempFarenheit; log->humidity = newLog.humidity; log->pressure = newLog.pressure; log->accelerometer = newLog.accelerometer; log->gyroscope = newLog.gyroscope; log->magnetometer = newLog.magnetometer; //TODO I get a weird error because of include <main> //You need that to include t //Not solved it yet, but you can do it by moving t or something //For the date represetation, that statement does it //log->date = asctime(&t); mail_box.put(log); Thread::wait(1000); } } };