Network, SD, Readall. comments added

Dependencies:   Peripherals Buffer_lib_v2 SD_Lib_EffedUP_ERP Time_Lib_v2 Year3_Version5 BMP280 Network_Lib TextLCD BME280

Revision:
11:799025124e87
Parent:
8:dde5976445b4
Child:
13:a89d4591af3f
--- a/main.cpp	Fri Dec 07 13:07:13 2018 +0000
+++ b/main.cpp	Fri Dec 07 15:27:15 2018 +0000
@@ -2,29 +2,17 @@
 #include "TextLCD.h"
 #include "SDBlockDevice.h"
 #include "FATFileSystem.h"
-#include "sample_hardware.hpp"
 #include "thread_functions.hpp"
-
-
+#include "SD_functions.hpp"
+#include "peripherals.hpp"
 
-//Function declarations
-void displayOnLcd();
-void updateRealTimeClock(char *buffer);
-void getLineFromSerial(char *keyBuffer, int bufferLength);
-void displayMessageOnConsole();
-void SettingTimeWithButtons ();
-void FunctionSensor();
-void FunctionTime();
-void FunctionSerial();
-
-TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7
-SDBlockDevice sd(PB_5, D12, D13, D10); // mosi, miso, sclk, cs
+//TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7
+//SDBlockDevice sd(PB_5, D12, D13, D10); // mosi, miso, sclk, cs
 Serial pc(SERIAL_TX, SERIAL_RX);
 time_t currentTime;
 char lcdBuffer[32];
 DigitalOut myled(LED1);
 Ticker ticker;
-DigitalIn SWUser(USER_BUTTON); 
 Mutex date_mutex;
 int setting;
 int t;
@@ -33,6 +21,7 @@
 Thread t1;
 Thread t2;
 Thread t3; 
+Thread t4;
 
 
 //LDR sensor
@@ -44,30 +33,15 @@
 
 //Main thread
 int main() {
-   
-    lcd.printf("Select Time Option\n\n");
-    
-    post();
     
-    //Initialise the SD card
-    if ( sd.init() != 0) {
-        printf("Init failed \n");
-        errorCode(FATAL);
-    } 
+    //Power On Check TODO
     
-    //Create a filing system for SD Card
-    FATFileSystem fs("sd", &sd);     
-
-    //Open to WRITE
-    FILE* fp = fopen("/sd/test.csv","a");
-    if (fp == NULL) {
-        error("Could not open file for write\n");
-        errorCode(FATAL);
-    }
+    lcd.printf("Select Time Option\n\n");
     
     // run threads
     t1.start(FunctionSensor);           
     t2.start(FunctionTime);   
     t3.start(FunctionSerial); 
+    t4.start(FunctionSD2);
        
 }