![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
FINAL PROJECT isn't it
Fork of ELEC351 by
Diff: main.cpp
- Revision:
- 8:0e4481b64353
- Parent:
- 7:dfe19413fdc2
- Child:
- 10:46946784326d
--- a/main.cpp Mon Dec 11 19:25:35 2017 +0000 +++ b/main.cpp Tue Dec 19 13:26:54 2017 +0000 @@ -1,15 +1,21 @@ /* ELEC 351 Group T Team Members : Christopher Hills, Thomas Morris -Current Verision 1 +Current Verision 3 Overiew: Working Tasks 1,5,7 + +Last Revision: Added DATA class structure +Todo: +make a mailbox of DATA class 120 long */ - +//Includes and Definitions #include "sample_hardware.hpp" #include "Networkbits.hpp" #include "rtos.h" #include "LED.hpp" +#include "DATA.hpp" +#include "NETWORK.hpp" #define SamplingTime 1 #define NotSamplingTime 0 #define Print_Time_to_LCD 1 @@ -17,11 +23,13 @@ #define TimerInterval 15 //This is in seconds #define EDGE_RISEN 1 #define EDGE_FALLEN 0 + + Serial pc(USBTX, USBRX); //SW1+SW2 are declared as interrupt ins in sample hardwarec.pp -// This is a very short demo that demonstrates all the hardware used in the coursework. -// You will need a network connection set up (covered elsewhere). The host PC should have the address 10.0.0.1 -//Thread ID + + +//Thread IDs osThreadId idMain; osThreadId id1; osThreadId id2; @@ -34,9 +42,11 @@ LED Yellow_led(PB_10); LED Green_led(PB_11); +//Tickers + Ticker Sample_timer; + //Threads -Thread nwrkThread; Thread t1; Thread t2; Thread t3; @@ -56,8 +66,15 @@ int mode = 0; -//Interrupt service routine for handling the timeout -void SW1TimeOutHandler() { + + +void Network() +{ + NETWORK_Print();//Runs the network + //Send DATA to the network +}//Interrupt service routine for handling the timeout +void SW1TimeOutHandler() +{ sw1TimeOut.detach(); //Stop the timeout counter firing SW1.fall(&SW1FallingEdge); //Now wait for a falling edge } @@ -79,7 +96,7 @@ void ModeSelection() { while(1){ - Thread::wait(1000); + Thread::wait(1000); //Detech the not required interrupt then rettach it when finshed if(mode == 0)//Print values to the LCD { @@ -208,6 +225,7 @@ t3.start(Time); t4.start(PrintTime); t5.start(ModeSelection); + t6.start(Network); //Main thread ID idMain = osThreadGetId(); //CMSIS RTOS call @@ -216,6 +234,8 @@ id1 = t1.gettid(); id2 = t2.gettid(); id3 = t3.gettid(); + id4 = t4.gettid(); + //id5 = t5.gettid(); //Toggle Green LED after a button has been pressed //Press either switch to unmount