GDP group 24 node core

Dependencies:   EthernetInterface SDFileSystem mbed-rtos mbed snail MbedJSONValue

sensorinterface.h

Committer:
Trumple
Date:
2014-11-11
Revision:
0:fcab3b154e49
Child:
3:71b090ec5c69

File content as of revision 0:fcab3b154e49:

#ifndef SENSORINTERFACE_H
 
#define SENSORINTERFACE_H

#include "mbed.h"
#include <map>
#include <vector>

#define DEBUG

struct sensor
{
    char type;
    int interval;
};


struct d_reply
{
    char type;
    vector<uint16_t> readings;
};


class sensorinterface
{
    public:
        sensorinterface();
        void requestData();
        bool isDataWaiting();
        d_reply readData();
    private:
        map<char, sensor> sensors;
        map<char, sensor>::iterator currentSensor;
        int update();
        void error(int);
        char findType(int address);
        int sendRequest(char address);
        void readyTrigger();
        bool ready;
        
        I2C i2c;
        InterruptIn readyLine;
};
#endif