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-16
Revision:
1:5731f31f96be
Parent:
0:22618cf06f45
Child:
2:3e7baa3e3fec

File content as of revision 1:5731f31f96be:

#ifndef INITIALIZATION_HPP
#define INITIALIZATION_HPP

#include "mbed.h"
#include "LocalPinNames.h"
#include "BridgeDriver.h"
#include "FrontPanelButtons.h"
#include "TextLCD.h"
#include "SDFileSystem.h"

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

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");
}


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

#endif