See graph

Dependencies:   MCP23017 SDFileSystem WattBob_TextLCD mbed

Fork of Embedded_Software_Assignment_2 by Steven Kay

Revision:
6:ceda53939eb8
Parent:
5:250f51c80ac1
Child:
7:2973bf297f3d
diff -r 250f51c80ac1 -r ceda53939eb8 Tasks.h
--- a/Tasks.h	Fri Feb 26 10:44:38 2016 +0000
+++ b/Tasks.h	Mon Feb 29 11:20:48 2016 +0000
@@ -25,9 +25,13 @@
 #ifndef _TASKS_H_
 #define _TASKS_H_
 
+// Includes to operate the LCD Display
 #include "MCP23017.h"
 #include "WattBob_TextLCD.h"
 
+// Includes to operate the SD Card system
+#include "SDFileSystem.h"
+
 // Global definitions
 #define HIGH 1
 #define LOW 0
@@ -48,7 +52,8 @@
 // Task 5 definitions
 
 // Task 6 definitions
-
+#define ERROR_CODE_CDTN_MET 3
+#define ERROR_CODE_CDTN_FAIL 0
 
 /* ####################### Class definitions and prototypes ####################### */
 
@@ -69,6 +74,8 @@
     volatile int measuredFrequency;
     
     InterruptIn *_squareWaveIn;
+    
+protected:
         
 };
 
@@ -82,8 +89,11 @@
     bool digitalInState();
     
 private:
+
+    
+protected:
     DigitalIn *_digitalInCheck;
-        
+    
 };
 
 
@@ -96,7 +106,11 @@
     void OutputWatchdogPulse();
         
 private:
-    DigitalOut *_Watchdog;    
+
+
+protected:
+    DigitalOut *_Watchdog;
+
 };
 
 
@@ -109,8 +123,12 @@
     float *returnAnalogReadings();
     
 private:
+
+
+protected:
     AnalogIn *_AnalogIn1;
-    AnalogIn *_AnalogIn2;        
+    AnalogIn *_AnalogIn2;   
+
 };
 
 //* ==================================== Task 5 ==================================== */
@@ -119,41 +137,58 @@
 {
 public:
     Task5(PinName sda, PinName scl, int address);
-    void updateDisplay(int task1Param,int task2Param, float task4Channel1, float task4Channel2);
-
-        
+    void updateDisplay( int task1Param,
+                        int task2Param,
+                        int errorState,
+                        float task4Channel1,
+                        float task4Channel2  );
+                             
 private:
 
 
 protected:
     MCP23017 *_par_port;
-    WattBob_TextLCD *_lcd;
-    
-        
+    WattBob_TextLCD *_lcd; 
+
 };
-//
+
 ///* ==================================== Task 6 ==================================== */
-//// Logical checks
-//class Task6
-//{
-//public:
-//    Task5();
-//        
-//private:
-//    
-//        
-//};
-//
-///* ==================================== Task 7 ==================================== */
-//// Save data to SD Card
-//class Task7
-//{
-//public:
-//    Task7();
-//        
-//private:
-//    
-//        
-//};
+// Logical checks
+class Task6
+{
+public:
+    int updateErrorCode(int switch_1, float analog1, float analog2);  
+
+private:
+
+
+protected:
+
+
+};
+
+/* ==================================== Task 7 ==================================== */
+// Save data to SD Card
+class Task7
+{
+public:
+    Task7(  PinName mosi,
+            PinName miso,
+            PinName sck,
+            PinName cs,
+            const char* SDName,
+            const char *dir     );
+
+    void writeData(const char *dataStream);
+    int openFile(const char *dirFile, const char *accessType);
+    void closeFile();
+    
+private:
+    void makeDirectory(const char *dir);
+
+protected:
+    SDFileSystem *_sd;
+    FILE *fp;
+};
 
 #endif