![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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:
- 2:3e7baa3e3fec
- Parent:
- 1:5731f31f96be
- Child:
- 3:078e9a1e8be3
--- a/Initialization.hpp Tue Sep 16 18:27:41 2014 +0000 +++ b/Initialization.hpp Thu Sep 18 23:38:11 2014 +0000 @@ -7,48 +7,69 @@ #include "FrontPanelButtons.h" #include "TextLCD.h" #include "SDFileSystem.h" +#include <string> +#include <vector> //Initializations -Timer timer; // general purpose timer -I2C i2c( P0_10, P0_11 ); // I2C bus (SDA, SCL) -BridgeDriver bridges(&i2c, 1); // Bridge -TextLCD_I2C lcd( &i2c, MCP23008_SA0, TextLCD::LCD20x4 ); // LCD -SDFileSystem sd(P0_18, P0_17, P0_15, P0_16, "sd"); // the pinout on the mbed LPC1768 - -DigitalIn killSw(KILL); - -extern const int MAX_LINE_LENGTH = 100; - -void initLCD(void); +extern Timer timer; // general purpose timer +extern I2C i2c; // I2C bus (SDA, SCL) +extern BridgeDriver bridges; // Bridge +extern TextLCD_I2C lcd; // LCD +extern SDFileSystem sd; // the pinout on the mbed LPC1768 -void fullInit() { - - killSw.mode(PullUp); - initLCD(); -} +extern DigitalIn killSw; + +extern const int MAX_LINE_LENGTH; + +void fullInit(); -void initLCD(void) { - - i2c.frequency(1000000); - lcd.setBacklight(TextLCD::LightOn); - wait(.6); - lcd.cls(); //clear the display - lcd.setAddress(0,0); - lcd.printf("LCD Initialized"); -} +void initLCD(void); struct Line{ - char *fullLine; //full line, starting from the beginning - char *currPartLine; //current line, meaning that it only knows whatever has not been used in the line + //string fullLine; //full line, starting from the beginning int lineNumber; //current line number in the program txt file that is running - char word[15][MAX_LINE_LENGTH]; //array of words from the line of text, assuming no more than 15 words will be in any given line + //vector<string> word; + string word[15]; //array of words from the line of text, assuming no more than 15 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; }; +// extern struct Line lineData; + + + +enum DeviceType{MOTOR, VOLTAGE_DRIVER}; +static const enum DeviceType Device_Map[] = {MOTOR, VOLTAGE_DRIVER}; +extern const char *DeviceNames[]; +extern int numDevices; +extern int currNumDevices; + + +class Device{ + + public: + string name; + enum DeviceType type; + static Device* newDevice(int, string, Line); + //void setName(string); + //void setType(DeviceType); + virtual int interpret(Line&) = 0; + /*{ + lcd.setAddress(0,3); + lcd.printf("CHECK Device "); + wait(2); + return 0; + }*/ +}; + +extern vector<Device*> devices; //Initialize array of devices, initially assume 15 devices will be used (will expand as needed) +//extern Device devices[]; + +void addDevice(int, Line); + #endif \ No newline at end of file