![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
See graph
Dependencies: MCP23017 SDFileSystem WattBob_TextLCD mbed
Fork of Embedded_Software_Assignment_2 by
Diff: Tasks.h
- Revision:
- 10:c0531edf4850
- Parent:
- 7:2973bf297f3d
- Child:
- 11:1069d300847b
diff -r 46408a8dea0c -r c0531edf4850 Tasks.h --- a/Tasks.h Wed Mar 02 09:38:47 2016 +0000 +++ b/Tasks.h Wed Mar 02 13:38:27 2016 +0000 @@ -9,17 +9,11 @@ Date: February 2016 - Function: This - - Version: 1.0 - - Version History - --------------- - - 1.1 rgdfgdfgdfggdfgdg - - 1.0 gdgddfdddgd - + Function: This file contains the function prototypes for the + included classes and methods. It also details some + constants used within the program and includes AUX + files, for instance the LCD system and the SD card. + ##################################################################### */ #ifndef _TASKS_H_ @@ -35,19 +29,20 @@ // Global definitions #define HIGH 1 #define LOW 0 - #define TRUE 1 #define FALSE 0 // Task 1 definitions -#define WATCHDOG_PULSE_WIDTH 15 // ms - +#define SAMPLE_FREQ 1 + // Task 2 definitions // Task 3 definitions +#define WATCHDOG_PULSE_WIDTH 15 // ms // Task 4 definitions #define NUM_ANALOG_SAMPLES 4.0 +#define V_SUPPLY 3.3 // Task 5 definitions #define BACK_LIGHT_ON(INTERFACE) INTERFACE->write_bit(1,BL_BIT) @@ -65,21 +60,26 @@ class Task1 { public: + // Public constructer method Task1(PinName squareWaveInPin); + + // Public method which initiates and returns a frequency measurement int ReadFrequency(); private: + // Private Timer object used to count the high or low time of input signal Timer _Task1Timer; + // Private method which contains the logic to measure frequency void MeasureFrequency(); - void StopCounter(); - - volatile int measuredFrequency; - InterruptIn *_squareWaveIn; - + // Private and volatile field contains most recent frequency + // Volatile to avoid the compiler modifying it for any reason + volatile int measuredFrequency; + protected: - + // Pointer to DigitalIn object + DigitalIn *_squareWaveIn; }; @@ -88,15 +88,18 @@ class Task2 { public: + // Public constructer method Task2(PinName digitalInCheckPin); + + // Public method to return the state of the DigitalIn pin bool digitalInState(); private: protected: + // Pointer to DigitalIn Object DigitalIn *_digitalInCheck; - }; @@ -105,15 +108,18 @@ class Task3 { public: + // Public constructer method Task3(PinName WatchdogPin); + + // Public method to output watchdog pulse opon calling method void OutputWatchdogPulse(); private: protected: + // Pointer to DigitalOut Object DigitalOut *_Watchdog; - }; @@ -122,16 +128,20 @@ class Task4 { public: + // Public constructer method Task4(PinName Analog1Pin,PinName Analog2Pin); + + // Public method to return pointer to array containing + // the filtered analog results, increment pointer once for both results float *returnAnalogReadings(); private: protected: + // Pointers to AnalogIn channels AnalogIn *_AnalogIn1; AnalogIn *_AnalogIn2; - }; //* ==================================== Task 5 ==================================== */ @@ -139,7 +149,10 @@ class Task5 { public: + // Public constructer method Task5(PinName sda, PinName scl, int address); + + // Public method to update display using input values from other tasks void updateDisplay( int task1Param, int task2Param, int errorState, @@ -150,9 +163,9 @@ protected: + // Pointers to required LCD objects MCP23017 *_par_port; WattBob_TextLCD *_lcd; - }; ///* ==================================== Task 6 ==================================== */ @@ -160,6 +173,7 @@ class Task6 { public: + // Public method to calculate condition of error state int updateErrorCode(int switch_1, float analog1, float analog2); private: @@ -175,22 +189,32 @@ class Task7 { public: + // Public constructer method Task7( PinName mosi, PinName miso, PinName sck, PinName cs, const char* SDName, const char *dir ); - + + // Public method to output Stream of data to open FILE void writeData(const char *dataStream); + + // Public method to open FILE int openFile(const char *dirFile, const char *accessType); + + // Public method to close FILE void closeFile(); private: + // Private method to construct a new directory on SD void makeDirectory(const char *dir); protected: + // Pointer to SDFileSystem object SDFileSystem *_sd; + + // Pointer to FILE object FILE *fp; };