Component Test's Software to work with "Universal Controller Box" - Software is an interpreter or "compiler" for programs to be done with a .txt file and read off of the SD Card
Dependencies: BridgeDriver FrontPanelButtons MCP23017 SDFileSystem TextLCD mbed
Diff: Initialization.hpp
- Revision:
- 11:bc9cd2869f95
- Parent:
- 9:5a0c4c6e39c7
- Child:
- 12:2e3e86714243
--- a/Initialization.hpp Wed Sep 24 22:54:36 2014 +0000 +++ b/Initialization.hpp Wed Oct 01 18:11:38 2014 +0000 @@ -17,8 +17,8 @@ /**********************************************************************************************************************************/ /**********************************************************************************************************************************/ -enum DeviceType{MOTOR, VOLTAGE_DRIVER, PIN_IN}; //ADD DEVICE NAME -static const enum DeviceType Device_Map[] = {MOTOR, VOLTAGE_DRIVER, PIN_IN}; //AND HERE ***NOTE TO KEEP SAME ORDER +enum DeviceType{MOTOR, VOLTAGE_DRIVER, PIN_IN, TIMER_DEVICE, CAN_DEVICE}; //ADD DEVICE NAME +static const enum DeviceType Device_Map[] = {MOTOR, VOLTAGE_DRIVER, PIN_IN, TIMER_DEVICE, CAN_DEVICE}; //AND HERE ***NOTE TO KEEP SAME ORDER /************************** <MUST MODIFY> *************************/ /**********************************************************************************************************************************/ @@ -39,8 +39,25 @@ extern DigitalIn killSw; +//extern Ticker errorWatcher; + extern const int MAX_LINE_LENGTH; extern int DummyMode; +extern FILE *selectedFile; +extern int errorFLAG; + +/******************************************************************************/ +/*** <Line Data Struct Initializations> ***/ +/******************************************************************************/ + +struct LineData{ + + int lineNumber; //current line number in the program txt file that is running + string word[50]; //array of words from the line of text, assuming no more than 50 words will be in any given line + //in this initialization there are 15 string (pointers) of size MAX_LINE_LENGTH each + int numWords; //Number of words in the given line + int lineAddress; //current line address in the SD Card +}; /******************************************************************************/ /*** <Function Initializations> ***/ @@ -52,25 +69,38 @@ void ErrorOut(string, int); //Outputs error message, line number, and formatting to LCD +int cyclePrograms(vector<string>, int, int, int); + +void resetLineData(LineData &); //reset and all variables of the Line Data Struct + +int interpretCommand(LineData &); + +int loopCommand(LineData &); + /******************************************************************************/ -/*** <Line Data Struct Initializations> ***/ +/*** <GoTo Label Initializations> ***/ /******************************************************************************/ -struct LineData{ - - //string fullLine; //full line, starting from the beginning - int lineNumber; //current line number in the program txt file that is running - //vector<string> word; - string word[50]; //array of words from the line of text, assuming no more than 50 words will be in any given line - //in this initialization there are 15 string (pointers) of size MAX_LINE_LENGTH each - int numWords; //Number of words in the given line - int lineAddress; +struct GoToLabel{ + + string name; //name of the GoTo Label + int lineNumber; //line number of the GoTo Label + int lineAddress; //line address of the GoTo Label }; -// -//extern struct Line lineData; +extern vector<GoToLabel> GoToLabels; +/******************************************************************************/ +/*** <Cycle Struct Initializations> ***/ +/******************************************************************************/ + +struct CycleWatch{ + + int numCycles; //number of cycles to go to + int startAddress; //starting address to seek back to on loop + int startLineNumber; //starting line number to reset to +}; /******************************************************************************/ /*** <Parent Device Class Initializations> ***/ @@ -90,9 +120,27 @@ static Device* newDevice(int, string, LineData); virtual int interpret(LineData&) = 0; virtual int off() = 0; + virtual int pause() = 0; + virtual int resume() = 0; }; -extern vector<Device*> devices; //Initialize array of devices, initially assume 15 devices will be used (will expand as needed) +extern vector<Device*> devices; //Initialize vector of devices +/******************************************************************************/ +/*** <Error Monitor Initializations> ***/ +/******************************************************************************/ +/* +struct ErrorCondition{ + + LineData errorToWatch; + LineData errorFix; + int hasFix; +}; + +//extern vector<ErrorCondition> errorMonitors; //Initialize vector of errors to monitor +extern ErrorCondition errorMonitors[15]; +extern int numErrorMonitors;*/ +//void ErrorMonitor(); //Monitors the conditions to watch for erroring, and pauses system if any of the conditions turn out to be true + #endif \ No newline at end of file