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:
6:b7f6e0c0f646
Parent:
5:f87129ac8bf3
Child:
7:8664a45f5ce1

File content as of revision 6:b7f6e0c0f646:

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

class Sampler
{
private:
    
public: 
    EventQueue SAMP_Queue;                  //Initialise the EventQueue

    void publishSample()
    {
        sample_message message = getData();
        m_oDisplay.LCD_Queue.call(&m_oDisplay, &LCD_Data::update_sensor_info, message);
        //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);
    }
    
    sample_message getData()
    {       
        float temp = sensor.getTemperature();
        float pressure = sensor.getPressure();
        float LDR = adcIn.read();
        #ifdef BME
        float humidity = sensor.getHumidity();
        #endif
        sample_message msg; // Define instance of message structure
        msg.temp = temp;
        msg.pressure = pressure;
        msg.ldr = LDR;
        return msg;
    }
    
    void updateTimeData();

    Sampler()   //Constructor 
    {
    }
    ~Sampler() //Destructor - should the instance go out of scope, this is called
    {
    }
};
#endif