Jorge Hernandez / Mbed 2 deprecated data_logger

Dependencies:   Buffer MMA8451Q mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers logger.h Source File

logger.h

00001 #ifndef LOGGER_H
00002 #define LOGGER_H
00003 
00004 #include "mbed.h"
00005 #include "rtos.h"
00006 #include "MMA8451Q.h"
00007 #include "buffer.h"
00008 
00009 const int BAUD_115200           = 115200;
00010 const int BUF_SIZE              = 128;
00011 const int MMA8451Q_I2C_ADDRESS  = (0x1D << 1);
00012 
00013 const int SEND_DATA_SIGNAL      = 0x01;
00014 const int GET_DATA_SIGNAL       = 0x02;
00015 const int LED_SIGNAL            = 0x03;
00016 
00017 const int SAMPLE_RATE           = 1000; //Milisegundos.
00018 const int TRANSMIT_RATE         = 60000; //Milisegundos.
00019 
00020 class Logger
00021 {
00022 private:
00023     Serial port;    
00024     DigitalOut redLed;
00025     DigitalOut blueLed;
00026     DigitalOut greenLed;
00027     MMA8451Q acc;
00028     //Thread tx_th;
00029     Thread data_th;
00030     Thread led_th;
00031     int msg;
00032     bool newMsg;
00033     Buffer<float> acc_x;
00034     
00035     static void led_thread(void const* args);
00036     static void data_thread(void const* args);
00037     void rcv_isr();
00038     
00039 
00040 public:
00041     Logger(PinName tx, PinName rx);
00042     float* getData();
00043     //static void tx_thread(void const* args);
00044     
00045     
00046     ~Logger();
00047 };
00048 
00049 
00050 
00051 #endif //LOGGER_H