ELEC351 / Mbed OS Year3_Version7_ET

Dependencies:   Peripherals SD_Lib Time_Lib_v2 Year3_Version5 BMP280 LCDFunctions TextLCD BME280 Serial_Lib

Files at this revision

API Documentation at this revision

Comitter:
erolleyparnell
Date:
Fri Dec 07 15:27:15 2018 +0000
Parent:
10:fa1c8db4e28c
Child:
12:cac14a3e396f
Commit message:
07/12/18 Compile Emily T and Courtney code

Changed in this revision

Buffer.lib Show annotated file Show diff for this revision Revisions of this file
Buffer/circular_buffer.cpp Show diff for this revision Revisions of this file
Buffer/circular_buffer.hpp Show diff for this revision Revisions of this file
Buffer/data_types.cpp Show diff for this revision Revisions of this file
Buffer/data_types.hpp Show diff for this revision Revisions of this file
ELEC350-Practicals-FZ429.lib Show diff for this revision Revisions of this file
LCDFunctions.lib Show annotated file Show diff for this revision Revisions of this file
Peripherals.lib Show annotated file Show diff for this revision Revisions of this file
SD_Lib.lib Show annotated file Show diff for this revision Revisions of this file
Serial_Lib.lib Show annotated file Show diff for this revision Revisions of this file
Threads_Lib.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.hpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Buffer.lib	Fri Dec 07 15:27:15 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/ELEC351/code/Buffer/#2dee25144721
--- a/Buffer/circular_buffer.cpp	Fri Dec 07 13:07:13 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-
-#include "mbed.h"
-#include "data_types.hpp"
-#include "platform/CircularBuffer.h"
-#define BUF_SIZE    120
-
-class Buffer
-{
-    //Variables
-    public:
-
-    private:
-    CircularBuffer<SensorData, BUF_SIZE> buf;
-    
-    protected:
-    
-    //Functions
-    public:
-    Buffer()
-    {
-
-    //char data_stream[] = "DataToBeAddedToBuffer";
-    }
-    ~Buffer(){}
-    void write_buffer()
-    {
-        if (!buf.full())
-        {
-            //buf.push(data)
-        }
-    }
-    void read_buffer()
-    {    
-    
-    }
-    void store_buffer()
-    {
-        
-    }
-    private:
-    protected:   
-     
-};
-
-
-           
\ No newline at end of file
--- a/Buffer/circular_buffer.hpp	Fri Dec 07 13:07:13 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-extern CircularBuffer<char, BUF_SIZE> buf;
-extern char data_stream[] = "DataToBeAddedToBuffer";
-extern void init_buffer();
\ No newline at end of file
--- a/Buffer/data_types.cpp	Fri Dec 07 13:07:13 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#include "mbed.h"
-
-typedef struct
-{
-time_t time;
- float y;
- float z;
-} SensorData;
\ No newline at end of file
--- a/Buffer/data_types.hpp	Fri Dec 07 13:07:13 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-typedef struct {} SensorData;
\ No newline at end of file
--- a/ELEC350-Practicals-FZ429.lib	Fri Dec 07 13:07:13 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/University-of-Plymouth-Stage-2-and-3/code/ELEC350-Practicals-FZ429/#d0e445a97c60
--- a/LCDFunctions.lib	Fri Dec 07 13:07:13 2018 +0000
+++ b/LCDFunctions.lib	Fri Dec 07 15:27:15 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/ELEC351/code/LCDFunctions/#8381146bc5b7
+https://os.mbed.com/teams/ELEC351/code/LCDFunctions/#de2f80988f12
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Peripherals.lib	Fri Dec 07 15:27:15 2018 +0000
@@ -0,0 +1,1 @@
+Peripherals#b358b85c532f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SD_Lib.lib	Fri Dec 07 15:27:15 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/ELEC351/code/SD_Lib/#dca48f1523ad
--- a/Serial_Lib.lib	Fri Dec 07 13:07:13 2018 +0000
+++ b/Serial_Lib.lib	Fri Dec 07 15:27:15 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/ELEC351/code/Serial_Lib/#f1c1af0cbefc
+https://os.mbed.com/teams/ELEC351/code/Serial_Lib/#19cd85a93e81
--- a/Threads_Lib.lib	Fri Dec 07 13:07:13 2018 +0000
+++ b/Threads_Lib.lib	Fri Dec 07 15:27:15 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/ELEC351/code/Year3_Version5/#1ee34aa664fd
+https://os.mbed.com/teams/ELEC351/code/Year3_Version5/#0e4c33e16eb7
--- 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);
        
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.hpp	Fri Dec 07 15:27:15 2018 +0000
@@ -0,0 +1,44 @@
+#ifndef __main__
+#define __main__
+
+#include "mbed.h"
+#include "TextLCD.h"
+#include "SDBlockDevice.h"
+#include "FATFileSystem.h"
+#include "sample_hardware.hpp"
+#include "thread_functions.hpp"
+
+//Function declarations
+extern void displayOnLcd();
+extern void updateRealTimeClock(char *buffer);
+extern void getLineFromSerial(char *keyBuffer, int bufferLength);
+extern void displayMessageOnConsole();
+extern void SettingTimeWithButtons ();
+extern void FunctionSensor();
+extern void FunctionTime();
+extern void FunctionSerial();
+
+extern TextLCD lcd(D9, D8, D7, D6, D4, D2); // rs, e, d4-d7
+extern SDBlockDevice sd(PB_5, D12, D13, D10); // mosi, miso, sclk, cs
+extern Serial pc(SERIAL_TX, SERIAL_RX);
+extern time_t currentTime;
+extern char lcdBuffer[32];
+extern DigitalOut myled(LED1);
+extern Ticker ticker;
+extern DigitalIn SWUser(USER_BUTTON); 
+extern Mutex date_mutex;
+extern int setting;
+extern int t;
+//InterruptIn SW1;
+
+extern Thread t1;
+extern Thread t2;
+extern Thread t3; 
+
+
+//LDR sensor
+extern AnalogIn LDD_ADC_In(A1);
+extern float fLDR = 0.0;
+extern float volts = 0.0;
+
+#endif
\ No newline at end of file