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.hpp
- Committer:
- mehatfie
- Date:
- 2014-09-23
- Revision:
- 6:d1594fd2ec5a
- Parent:
- 5:e36e0538a903
- Child:
- 9:5a0c4c6e39c7
File content as of revision 6:d1594fd2ec5a:
#ifndef INITIALIZATION_HPP
#define INITIALIZATION_HPP
#include "mbed.h"
#include "LocalPinNames.h"
#include "BridgeDriver.h"
#include "FrontPanelButtons.h"
#include "TextLCD.h"
#include "SDFileSystem.h"
#include <string>
#include <vector>
/**********************************************************************************************************************************/
/**********************************************************************************************************************************/
/************************** <MUST MODIFY> *************************/
/**********************************************************************************************************************************/
/**********************************************************************************************************************************/
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
/************************** <MUST MODIFY> *************************/
/**********************************************************************************************************************************/
/**********************************************************************************************************************************/
/******************************************************************************/
/*** <Global Initializations> ***/
/******************************************************************************/
//Initializations
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
extern DigitalIn killSw;
extern const int MAX_LINE_LENGTH;
extern int DummyMode;
/******************************************************************************/
/*** <Function Initializations> ***/
/******************************************************************************/
void fullInit(); //Perform and call any needed initializations
void initLCD(void); //Initialize the LCD
/******************************************************************************/
/*** <Line Data Struct 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;
};
//
//extern struct Line lineData;
/******************************************************************************/
/*** <Parent Device Class Initializations> ***/
/******************************************************************************/
extern const string DeviceNames[];
extern int numDevices;
extern int currNumDevices;
class Device{
public:
string name;
enum DeviceType type;
static Device* newDevice(int, string, LineData);
virtual int interpret(LineData&) = 0;
};
extern vector<Device*> devices; //Initialize array of devices, initially assume 15 devices will be used (will expand as needed)
#endif