See graph

Dependencies:   MCP23017 SDFileSystem WattBob_TextLCD mbed

Fork of Embedded_Software_Assignment_2 by Steven Kay

Revision:
5:250f51c80ac1
Parent:
4:b85bc0d810e1
Child:
6:ceda53939eb8
--- a/main.cpp	Fri Feb 26 10:36:23 2016 +0000
+++ b/main.cpp	Fri Feb 26 10:44:38 2016 +0000
@@ -30,25 +30,16 @@
 #define BACK_LIGHT_ON(INTERFACE) INTERFACE->write_bit(1,BL_BIT)
 #define BACK_LIGHT_OFF(INTERFACE) INTERFACE->write_bit(0,BL_BIT)
 
-MCP23017 *par_port;
-WattBob_TextLCD *lcd;
-
 DigitalOut myled(LED1);
 
 Task1 task1(p11);                   // Square wave Measurement
 Task2 task2_switch1(p12);           // Read digital Output
 Task3 task3(p13);                   // Watchdog Pulse
 Task4 task4(p15,p16);               // Read analog Inputs
-
-void updateDisplay(int task1Param,int task2Param, float task4Channel1, float task4Channel2);
+Task5 task5(p9,p10,0x40);           // Output to LCD Display
 
 int main() {
-    
-    par_port = new MCP23017(p9,p10,0x40);
-    lcd = new WattBob_TextLCD(par_port);
-    par_port -> write_bit(1,BL_BIT);
 
-    
     int task1Frequency = task1.ReadFrequency();
     printf("Task 1 Frequency %d Hz\r\n",task1Frequency);
     
@@ -62,20 +53,12 @@
     float channel2 = *(analogReading+1);
     printf("Analog Readings:\r\nChannel 1-%f\r\nChannel 2-%f\r\n",channel1,channel2);
     
-    updateDisplay(task1Frequency,task2SwitchState,channel1,channel2);
+    task5.updateDisplay(task1Frequency,task2SwitchState,channel1,channel2);
+    
     while(1) {
         myled = 1;
         wait(0.2);
         myled = 0;
         wait(0.2);
     }
-}
-
-void updateDisplay(int task1Param,int task2Param, float task4Channel1, float task4Channel2)
-{
-    lcd -> cls();
-    lcd -> locate(0,0);
-    lcd -> printf("F-%4dHz S1-%d ",task1Param,task2Param);
-    lcd -> locate(1,0);
-    lcd -> printf("C1-%1.2f C2-%1.2f ",task4Channel1,task4Channel2);
 }
\ No newline at end of file