V24Control.h

Go to the documentation of this file.
00001 #ifndef __V24_H__
00002 #define __V24_H__
00003 
00004 #include "v24_commands.h"
00005 #include "ValueIteration.h"
00006 //#include "global.h"
00007 
00008 
00009 /*************************
00010  * baud-rate definitions *
00011  *************************/
00012 //#define MYUBRR    FOSC/16/BAUD-1 
00013 //#define MYUBRR    5    /* 115.200 bps at 11,0592 MHz */
00014 #define MYUBRR           35   /* 19.200 bps at 11,0592 MHz) */
00015 //#define MYUBRR    25   /* 4.800 bps at 1 MHz */
00016 //#define MYUBRR    143  /* 4.800 bps at 11,0592 MHz */
00017 //#define MYUBRR    11   /* 57.600 bps at 11,05920 MHz */
00018 //#define MYUBRR    71   /* 9.600 bps at 11,05920 MHz */
00019 //#define MYUBRR    287  /* 2.400 bps at 11,05920 MHz */
00020 
00021 
00022 /********************************************************
00023  * uniform command structure
00024  *****************************************************/
00025 typedef struct V24Command {
00026      unsigned char command;
00027      unsigned char dataLength;
00028      unsigned char data[18];
00029 } V24COMMAND;
00030 
00035 class V24Control {
00036 
00037   public:
00038           void init();
00039           void processCommand();
00040           bool newDataReceived();
00041           bool receiveCommand (V24COMMAND *c);
00042 
00043           void transmit(unsigned char data);
00044           bool receive(unsigned char*);
00045           
00046           //void disableInterrupt();
00047           //void enableInterrupt();
00048           
00049           ValueIteration vi;
00050 
00051   private:
00052           bool transmitCommand (V24COMMAND *c);
00053 
00054           bool processGetDebug();
00055           bool processGetGamma();
00056           bool processGetExplorationConfig();
00057           void processSetGamma(V24COMMAND *cmd);
00058           bool processGetGridsize();
00059           bool processSetGridsize(V24COMMAND *cmd);
00060           bool processGetState(V24COMMAND *cmd);
00061           bool processSetState(V24COMMAND *cmd);
00062           bool processSetMotorPosition(V24Command);
00063 //        bool processGetIterations();
00064 
00065 
00066           void flushReceiveBuffer();
00067           bool transmitReceiveCommandProcessed(unsigned char _code, unsigned char _error);
00068 
00069           //unsigned char loopCount;
00070           STATE tmpState;
00071           bool rxtx;
00072           bool newDataAvailable;
00073 };
00074 
00075 
00076 #endif

Generated on Wed Mar 25 12:58:40 2009 for Crawling Robot Microcontroller Software by  doxygen 1.5.5