Com_GUI.h 1.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/*
  Com_GUI.h - Library for communication between Arduino MEGA and the Neurostimulator GUI
*/

#ifndef Com_GUI_h
#define Com_GUI_h

//Libraries
#include <stdlib.h>               
#include <string.h>               
#include <math.h>
#include <Stdint.h>
#include <Arduino.h>

#define BAUDRATE 9600

class Com_GUI
{
    public:     
        void SerialConfig();   
        void GetDataFromPC();
        void SaveProtocolData();
        void ReplyToPC( char firstChar, char secondChar );
        unsigned char RecvCommandHndlr();
        //void HeartBeat();
        //void ParseData();
        uint8_t prot = 0;
        static const byte buffSize = 40;
        unsigned char messageFromPC[buffSize] = {0};
 
    private:
        
        const char *readyMessage = "<Arduino is ready>";     
        const char startMarker = '<';
        const char endMarker = '>'; 
        unsigned char inputBuffer[buffSize];
        uint8_t bytesRecvd;
        bool readInProgress = false;
        bool newDataFromPC = false;
        unsigned char rcvStatus = 0;        
        unsigned char rcvProt[2][3];
        unsigned int rcvParam[6][3];
};
 
#endif