Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Final351CW_FINAL by
main.cpp
00001 /* ELEC351 COURSEWORK 2018 00002 DESIGNED USING MBED ONLINE COMPILER IMPORTED TO KEIL 00003 LIAM GRAZIER // DOUG TILLEY // ALEX BARON 00004 */ 00005 #include "components.hpp" 00006 #include "mbed.h" 00007 #include "network.hpp" 00008 #include "lglcd.h" 00009 #include "stx.hpp" 00010 //voids for ticker attached tasks 00011 void inter1(); 00012 void inter2(); 00013 void inter3(); 00014 void inter4(); 00015 void inter5(); 00016 //thread initalised with priorities 00017 Thread samplesThread(osPriorityNormal); 00018 Thread sdThread(osPriorityHigh); 00019 Thread sdRemoveThread(osPriorityHigh); 00020 Thread timebuttonThread(osPriorityNormal); 00021 Thread stxThread(osPriorityLow); 00022 Thread netThread(osPriorityRealtime); 00023 //interrupt assign 00024 InterruptIn sdex(USER_BUTTON); 00025 //ticker assigns 00026 Ticker samples; 00027 Ticker remov; 00028 Ticker storage; 00029 Ticker netTick; 00030 Ticker serielTick; 00031 //sd card attached signal flag task 00032 void inter1() 00033 { 00034 sdcheck(); 00035 samplesThread.signal_set(SIG_READY); 00036 } 00037 //sampling attached signal flag task 00038 void inter2() 00039 { 00040 sdThread.signal_set(SIG_READY2); 00041 } 00042 //sd card remove attached signal flag task 00043 void inter3() 00044 { 00045 if(sdex == 1)//checks if remove button *USER BUTTON triggered by interrupt has been flagged to indicated remove 00046 { 00047 sdRemoveThread.signal_set(SIG_REMOVE); 00048 } 00049 } 00050 //network attached signal flag task 00051 void inter4() 00052 { 00053 netThread.signal_set(SIG_NET); 00054 } 00055 //setial comms attached signal flag task 00056 void inter5() 00057 { 00058 stxThread.signal_set(SIG_SX); 00059 } 00060 int main() 00061 { 00062 lglcd mylcd(D7,D6,D5,D4,D3,D2);//setup lcd 00063 setuptime();//setup time to default 00064 sdrun(); //init sd 00065 lcdstart();//run lcd start code 00066 welcomemsg(); //display welcome msg in the terminal 00067 sdThread.start(sdwrite); 00068 storage.attach(&inter2,1); //attached the storage SD ticker to the allocated flag task, this triggers every 1secs 00069 samplesThread.start(runanalysis); 00070 samples.attach(&inter1,1); //attached the samples ticker to the allocated flag task, this triggers every 1secs 00071 sdRemoveThread.start(sdremove); 00072 remov.attach(&inter3,3);//attached the SD Remove ticker to the allocated flag task, this triggers every 3secs 00073 netThread.start(networksend); 00074 netTick.attach(&inter4,0.01);//attached the network ticker to the allocated flag task, this triggers every 0.01secs 00075 stxThread.start(useseriel);// 00076 serielTick.attach(&inter5,0.1);//attached the serial ticker to the allocated flag task, this triggers every 0.1secs 00077 }
Generated on Mon Jul 18 2022 05:40:54 by
1.7.2
