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 0NicksCoursework_copywithserialtime by
Diff: main.cpp
- Revision:
- 8:582ac4c5a524
- Parent:
- 7:dd303488e55d
- Child:
- 9:e27b3f34de24
--- a/main.cpp Sun Jan 07 21:29:12 2018 +0000
+++ b/main.cpp Tue Jan 09 05:43:43 2018 +0000
@@ -2,24 +2,28 @@
#include "mbed.h"
#include "network.hpp"
#include "lglcd.h"
-InterruptIn sw1(USER_BUTTON);
+#include "stx.hpp"
Thread samplesThread(osPriorityNormal);
Thread sdThread(osPriorityLow);
-Thread sdRemoveThread(osPriorityLow);
-//Thread rtThread;
-//Thread stxThread;
+Thread sdRemoveThread(osPriorityHigh);
+Thread timebuttonThread(osPriorityNormal);
+Thread stxThread(osPriorityLow);
Thread netThread(osPriorityRealtime);
+Mutex SD;
void inter1();
void inter2();
void inter3();
void inter4();
-// 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
+void inter5();
+void inter6();
Ticker samples;
Ticker remov;
InterruptIn sdex(USER_BUTTON);
Ticker storage;
Ticker netTick;
+Ticker serielTick;
+Ticker buttonTick;
+int T = 5;
void inter1(){
sdcheck();
samplesThread.signal_set(SIG_READY);
@@ -28,27 +32,37 @@
sdThread.signal_set(SIG_READY2);
}
void inter3(){
- printf("CHECK REMOVE BUTTON\n\r");
+ //printf("CHECK REMOVE BUTTON\n\r");
if(sdex == 1){
+ //printf("BUTTON IN");
sdRemoveThread.signal_set(SIG_REMOVE);
}
}
void inter4(){
netThread.signal_set(SIG_NET);
}
+void inter5(){
+ stxThread.signal_set(SIG_SX);
+}
+//void inter6(){
+// timebuttonThread.signal_set(SIG_button);
+//}
int main(){
+lglcd mylcd(D7,D6,D5,D4,D3,D2);
+setuptime();
sdrun();
-lglcd mylcd(D7,D6,D5,D4,D3,D2);
-mylcd.clear();
+lcdstart();
+welcomemsg();
sdThread.start(sdwrite);
-storage.attach(&inter2,10); //runs send to sd based on last number (5) in this case (every 5 seconds)
+storage.attach(&inter2,T); //runs send to sd based on last number (10) in this case (every 10 seconds)
samplesThread.start(runanalysis);
-samples.attach(&inter1,1); //runs analysis based on last number (1) in this case (every 1 second)
+samples.attach(&inter1,T); //runs analysis based on last number (1) in this case (every 1 second)
sdRemoveThread.start(sdremove);
-remov.attach(&inter3,3);//checks sd remove key every second
+remov.attach(&inter3,3);//checks sd remove key every 3 second
netThread.start(networksend);
netTick.attach(&inter4,0.01);
-
-
-
+stxThread.start(useseriel);
+serielTick.attach(&inter5,0.1);
+//timebuttonThread.start(//insertnamehere);
+//buttonTick.attach(&inter6,0.3);
}
\ No newline at end of file
