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
Initialization.cpp
- Committer:
- mehatfie
- Date:
- 2014-09-18
- Revision:
- 2:3e7baa3e3fec
- Child:
- 3:078e9a1e8be3
File content as of revision 2:3e7baa3e3fec:
#include "Initialization.hpp" #include "Motor.hpp" #include "VoltageDriver.hpp" //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); const int MAX_LINE_LENGTH = 100; //struct Line lineData; Device* Device::newDevice(int deviceFound, string _name, Line lineData){ switch (Device_Map[deviceFound]){ case MOTOR: //Device::setName(_name); //Device::setType(MOTOR); return new Motor(lineData); break; case VOLTAGE_DRIVER: //setName(_name); //setType(MOTOR); return new VoltageDriver(lineData); break; } } /* void Device::setName(string _name){ this->name = _name; } void Device::setType(DeviceType _type){ this->type = _type; }*/ const char *DeviceNames[] = {"MOTOR", "VOLTAGE_DRIVER"}; int numDevices = sizeof(DeviceNames)/sizeof(DeviceNames[0]); int currNumDevices = 0; vector<Device*> devices; //Device devices[15]; void addDevice(int deviceFound, Line &lineData){ devices[currNumDevices] = Device::newDevice(deviceFound, lineData.word[1], lineData); currNumDevices++; } void fullInit() { killSw.mode(PullUp); initLCD(); } 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"); }