Jorge Hernandez / Mbed 2 deprecated data_logger

Dependencies:   Buffer MMA8451Q mbed-rtos mbed

Committer:
jhestolano
Date:
Tue Jun 04 01:42:20 2013 +0000
Revision:
0:93d648fde6cf
Simple data logger.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhestolano 0:93d648fde6cf 1 #ifndef LOGGER_H
jhestolano 0:93d648fde6cf 2 #define LOGGER_H
jhestolano 0:93d648fde6cf 3
jhestolano 0:93d648fde6cf 4 #include "mbed.h"
jhestolano 0:93d648fde6cf 5 #include "rtos.h"
jhestolano 0:93d648fde6cf 6 #include "MMA8451Q.h"
jhestolano 0:93d648fde6cf 7 #include "buffer.h"
jhestolano 0:93d648fde6cf 8
jhestolano 0:93d648fde6cf 9 const int BAUD_115200 = 115200;
jhestolano 0:93d648fde6cf 10 const int BUF_SIZE = 128;
jhestolano 0:93d648fde6cf 11 const int MMA8451Q_I2C_ADDRESS = (0x1D << 1);
jhestolano 0:93d648fde6cf 12
jhestolano 0:93d648fde6cf 13 const int SEND_DATA_SIGNAL = 0x01;
jhestolano 0:93d648fde6cf 14 const int GET_DATA_SIGNAL = 0x02;
jhestolano 0:93d648fde6cf 15 const int LED_SIGNAL = 0x03;
jhestolano 0:93d648fde6cf 16
jhestolano 0:93d648fde6cf 17 const int SAMPLE_RATE = 1000; //Milisegundos.
jhestolano 0:93d648fde6cf 18 const int TRANSMIT_RATE = 60000; //Milisegundos.
jhestolano 0:93d648fde6cf 19
jhestolano 0:93d648fde6cf 20 class Logger
jhestolano 0:93d648fde6cf 21 {
jhestolano 0:93d648fde6cf 22 private:
jhestolano 0:93d648fde6cf 23 Serial port;
jhestolano 0:93d648fde6cf 24 DigitalOut redLed;
jhestolano 0:93d648fde6cf 25 DigitalOut blueLed;
jhestolano 0:93d648fde6cf 26 DigitalOut greenLed;
jhestolano 0:93d648fde6cf 27 MMA8451Q acc;
jhestolano 0:93d648fde6cf 28 //Thread tx_th;
jhestolano 0:93d648fde6cf 29 Thread data_th;
jhestolano 0:93d648fde6cf 30 Thread led_th;
jhestolano 0:93d648fde6cf 31 int msg;
jhestolano 0:93d648fde6cf 32 bool newMsg;
jhestolano 0:93d648fde6cf 33 Buffer<float> acc_x;
jhestolano 0:93d648fde6cf 34
jhestolano 0:93d648fde6cf 35 static void led_thread(void const* args);
jhestolano 0:93d648fde6cf 36 static void data_thread(void const* args);
jhestolano 0:93d648fde6cf 37 void rcv_isr();
jhestolano 0:93d648fde6cf 38
jhestolano 0:93d648fde6cf 39
jhestolano 0:93d648fde6cf 40 public:
jhestolano 0:93d648fde6cf 41 Logger(PinName tx, PinName rx);
jhestolano 0:93d648fde6cf 42 float* getData();
jhestolano 0:93d648fde6cf 43 //static void tx_thread(void const* args);
jhestolano 0:93d648fde6cf 44
jhestolano 0:93d648fde6cf 45
jhestolano 0:93d648fde6cf 46 ~Logger();
jhestolano 0:93d648fde6cf 47 };
jhestolano 0:93d648fde6cf 48
jhestolano 0:93d648fde6cf 49
jhestolano 0:93d648fde6cf 50
jhestolano 0:93d648fde6cf 51 #endif //LOGGER_H