Liam Grazier
/
0NicksCoursework-lg
diajzifsajoifajsoifaj
Fork of ELEC350-CWTEMPLATE-2017 by
main.cpp
- Committer:
- liam_grazier
- Date:
- 2018-01-07
- Revision:
- 7:dd303488e55d
- Parent:
- 6:f0601ebd2423
File content as of revision 7:dd303488e55d:
#include "components.hpp" #include "mbed.h" #include "network.hpp" #include "lglcd.h" InterruptIn sw1(USER_BUTTON); Thread samplesThread(osPriorityNormal); Thread sdThread(osPriorityLow); Thread sdRemoveThread(osPriorityLow); //Thread rtThread; //Thread stxThread; Thread netThread(osPriorityRealtime); 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 Ticker samples; Ticker remov; InterruptIn sdex(USER_BUTTON); Ticker storage; Ticker netTick; void inter1(){ sdcheck(); samplesThread.signal_set(SIG_READY); } void inter2(){ sdThread.signal_set(SIG_READY2); } void inter3(){ printf("CHECK REMOVE BUTTON\n\r"); if(sdex == 1){ sdRemoveThread.signal_set(SIG_REMOVE); } } void inter4(){ netThread.signal_set(SIG_NET); } int main(){ sdrun(); lglcd mylcd(D7,D6,D5,D4,D3,D2); mylcd.clear(); sdThread.start(sdwrite); storage.attach(&inter2,10); //runs send to sd based on last number (5) in this case (every 5 seconds) samplesThread.start(runanalysis); samples.attach(&inter1,1); //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 netThread.start(networksend); netTick.attach(&inter4,0.01); }