Version 8, working version with Alix, sams and ollies code. Displays time, date and sensor info onto terminal, LCD and networking, and saves onto SD card.

Dependencies:   BMP280 ELEC350-Practicals-FZ429 TextLCD BME280 ntp-client

Sampler.hpp

Committer:
O_Thom
Date:
2018-11-29
Revision:
5:f87129ac8bf3
Parent:
4:740cba3f2716
Child:
6:b7f6e0c0f646

File content as of revision 5:f87129ac8bf3:

#ifndef _SAMPLER_
#define _SAMPLER_
#include "message.hpp"
#include "mbed.h"
#include "LCD.hpp"
#define Activate_Flag 1

EventQueue SAMP_Queue;  //create an event queue for main

class Sampler
{
private:
        EventQueue sampEQueue;                  //Initialise the EventQueue
public: 
    void publishSample()
    {
        getData();
        m_oDisplay.LCD_Queue.call(&m_oDisplay, &LCD_Data::update_sensor_info, sample);
        //SD_Queue.call(&m_oSD_data, &SD_Queue::update_sensor_info, sample_data, sample_data);
        //SERIAL_Queue.call(&m_oSERIAL_data, &SERIAL_Queue::update_sensor_info, sample_data, sample_data);
    }
    void getData()
    {
        int sw1State = SW1.read();
        int sw2State = SW2.read();        
        float temp = sensor.getTemperature();
        float pressure = sensor.getPressure();
        #ifdef BME
        float humidity = sensor.getHumidity();
        #endif
        sample.temp = temp;
        sample.pressure = pressure;
        sample.sw1State = sw1State;
        sample.swState = sw1State;
    }
    Sampler()   //Constructor 
    {   
    }
    ~Sampler() //Destructor - should the instance go out of scope, this is called
    {
    }
};
#endif