![](/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
Initialization.hpp@1:5731f31f96be, 2014-09-16 (annotated)
- Committer:
- mehatfie
- Date:
- Tue Sep 16 18:27:41 2014 +0000
- Revision:
- 1:5731f31f96be
- Parent:
- 0:22618cf06f45
- Child:
- 2:3e7baa3e3fec
- Noticed having issues with code in terms of memory(?); - Loop functionality works fine; - Depending on the number of cycles, the code will randomly freeze up. Same thing happens if you extend the number of tasks within the loop, and decrease count
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mehatfie | 0:22618cf06f45 | 1 | #ifndef INITIALIZATION_HPP |
mehatfie | 0:22618cf06f45 | 2 | #define INITIALIZATION_HPP |
mehatfie | 0:22618cf06f45 | 3 | |
mehatfie | 0:22618cf06f45 | 4 | #include "mbed.h" |
mehatfie | 0:22618cf06f45 | 5 | #include "LocalPinNames.h" |
mehatfie | 0:22618cf06f45 | 6 | #include "BridgeDriver.h" |
mehatfie | 0:22618cf06f45 | 7 | #include "FrontPanelButtons.h" |
mehatfie | 0:22618cf06f45 | 8 | #include "TextLCD.h" |
mehatfie | 0:22618cf06f45 | 9 | #include "SDFileSystem.h" |
mehatfie | 0:22618cf06f45 | 10 | |
mehatfie | 0:22618cf06f45 | 11 | //Initializations |
mehatfie | 0:22618cf06f45 | 12 | Timer timer; // general purpose timer |
mehatfie | 0:22618cf06f45 | 13 | I2C i2c( P0_10, P0_11 ); // I2C bus (SDA, SCL) |
mehatfie | 0:22618cf06f45 | 14 | BridgeDriver bridges(&i2c, 1); // Bridge |
mehatfie | 0:22618cf06f45 | 15 | TextLCD_I2C lcd( &i2c, MCP23008_SA0, TextLCD::LCD20x4 ); // LCD |
mehatfie | 0:22618cf06f45 | 16 | SDFileSystem sd(P0_18, P0_17, P0_15, P0_16, "sd"); // the pinout on the mbed LPC1768 |
mehatfie | 0:22618cf06f45 | 17 | |
mehatfie | 0:22618cf06f45 | 18 | DigitalIn killSw(KILL); |
mehatfie | 0:22618cf06f45 | 19 | |
mehatfie | 0:22618cf06f45 | 20 | extern const int MAX_LINE_LENGTH = 100; |
mehatfie | 0:22618cf06f45 | 21 | |
mehatfie | 0:22618cf06f45 | 22 | void initLCD(void); |
mehatfie | 0:22618cf06f45 | 23 | |
mehatfie | 0:22618cf06f45 | 24 | void fullInit() { |
mehatfie | 0:22618cf06f45 | 25 | |
mehatfie | 0:22618cf06f45 | 26 | killSw.mode(PullUp); |
mehatfie | 0:22618cf06f45 | 27 | initLCD(); |
mehatfie | 0:22618cf06f45 | 28 | } |
mehatfie | 0:22618cf06f45 | 29 | |
mehatfie | 0:22618cf06f45 | 30 | void initLCD(void) { |
mehatfie | 0:22618cf06f45 | 31 | |
mehatfie | 0:22618cf06f45 | 32 | i2c.frequency(1000000); |
mehatfie | 0:22618cf06f45 | 33 | lcd.setBacklight(TextLCD::LightOn); |
mehatfie | 0:22618cf06f45 | 34 | wait(.6); |
mehatfie | 0:22618cf06f45 | 35 | lcd.cls(); //clear the display |
mehatfie | 0:22618cf06f45 | 36 | lcd.setAddress(0,0); |
mehatfie | 0:22618cf06f45 | 37 | lcd.printf("LCD Initialized"); |
mehatfie | 0:22618cf06f45 | 38 | } |
mehatfie | 0:22618cf06f45 | 39 | |
mehatfie | 0:22618cf06f45 | 40 | |
mehatfie | 0:22618cf06f45 | 41 | struct Line{ |
mehatfie | 0:22618cf06f45 | 42 | |
mehatfie | 0:22618cf06f45 | 43 | char *fullLine; //full line, starting from the beginning |
mehatfie | 0:22618cf06f45 | 44 | char *currPartLine; //current line, meaning that it only knows whatever has not been used in the line |
mehatfie | 0:22618cf06f45 | 45 | int lineNumber; //current line number in the program txt file that is running |
mehatfie | 0:22618cf06f45 | 46 | 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 |
mehatfie | 0:22618cf06f45 | 47 | //in this initialization there are 15 string (pointers) of size MAX_LINE_LENGTH each |
mehatfie | 0:22618cf06f45 | 48 | int numWords; //Number of words in the given line |
mehatfie | 1:5731f31f96be | 49 | int lineAddress; |
mehatfie | 0:22618cf06f45 | 50 | }; |
mehatfie | 0:22618cf06f45 | 51 | |
mehatfie | 0:22618cf06f45 | 52 | extern struct Line lineData; |
mehatfie | 0:22618cf06f45 | 53 | |
mehatfie | 0:22618cf06f45 | 54 | #endif |