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-18
Revision:
2:3e7baa3e3fec
Parent:
1:5731f31f96be
Child:
3:078e9a1e8be3

File content as of revision 2:3e7baa3e3fec:

#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>

//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;

void fullInit();
 
void initLCD(void);


struct Line{
    
    //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[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