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.
Dependencies: TextLCD mbed-rtos mbed
Revision 5:f5f4b730a6fb, committed 2014-10-06
- Comitter:
- xueliz
- Date:
- Mon Oct 06 20:55:33 2014 +0000
- Parent:
- 4:f6eee8bb51c2
- Commit message:
- using signal v2
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 06 20:40:53 2014 +0000
+++ b/main.cpp Mon Oct 06 20:55:33 2014 +0000
@@ -15,6 +15,10 @@
int mm [] = {0, 0};
int ss [] = {0, 0};
int MM [] = {0, 0};
+int mm_stop [] = {0, 0};
+int ss_stop [] = {0, 0};
+int MM_stop [] = {0, 0};
+
int run_status = STOP;
// functions
@@ -52,6 +56,9 @@
mm[0] = mm[1] = 0;
ss[0] = ss[1] = 0;
MM[0] = MM[1] = 0;
+ mm_stop[0] = mm_stop[1] = 0;
+ ss_stop[0] = ss_stop[1] = 0;
+ MM_stop[0] = MM_stop[1] = 0;
thread_display.signal_set(RUN);
}
}
@@ -75,7 +82,7 @@
void update_mm(void const *args) {
while(1){
Thread::signal_wait(RUN);
- Thread::wait(10-mm[0]);
+ Thread::wait(10-mm_stop[0]);
mm[0]++;
if (mm[0] >= 10) {
mm[0] = 0;
@@ -97,13 +104,15 @@
mm[1] = 0;
}
}
+ mm_stop[1] = mm[1];
+ mm_stop[0] = mm[0];
}
}
void update_ss(void const *args) {
while(1) {
Thread::signal_wait(RUN);
- Thread::wait(1000-100*mm[1]-10*mm[0]);
+ Thread::wait(1000-100*mm_stop[1]-10*mm_stop[0]);
ss[0]++;
if (ss[0] >= 10) {
ss[0] = 0;
@@ -125,13 +134,15 @@
ss[1] = 0;
}
}
+ ss_stop[1] = ss[1];
+ ss_stop[0] = ss[0];
}
}
void update_MM(void const *args) {
while(1) {
Thread::signal_wait(RUN);
- Thread::wait(60000-10000*ss[1]-1000*ss[0]-100*mm[1]-10*mm[0]);
+ Thread::wait(60000-10000*ss_stop[1]-1000*ss_stop[0]-100*mm_stop[1]-10*mm_stop[0]);
MM[0]++;
if (MM[0] >= 10) {
MM[0] = 0;
@@ -153,5 +164,7 @@
MM[1] = 0;
}
}
+ MM_stop[1] = MM[1];
+ MM_stop[0] = MM[0];
}
}