blah

Committer:
gatedClock
Date:
Wed Sep 11 01:57:42 2013 +0000
Revision:
0:f82994ac4d1b
commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gatedClock 0:f82994ac4d1b 1 #include "mbed.h"
gatedClock 0:f82994ac4d1b 2
gatedClock 0:f82994ac4d1b 3 Queue<int, 1> queueModTotalTime; // message to modify total time.
gatedClock 0:f82994ac4d1b 4
gatedClock 0:f82994ac4d1b 5
gatedClock 0:f82994ac4d1b 6
gatedClock 0:f82994ac4d1b 7 int dMessage; // message.
gatedClock 0:f82994ac4d1b 8
gatedClock 0:f82994ac4d1b 9 while(1) // thread loop.
gatedClock 0:f82994ac4d1b 10 {
gatedClock 0:f82994ac4d1b 11
gatedClock 0:f82994ac4d1b 12 //--- // TOTAL TIME CONTROL.
gatedClock 0:f82994ac4d1b 13
gatedClock 0:f82994ac4d1b 14 // encoded integers will be sent,
gatedClock 0:f82994ac4d1b 15 // not pointers.
gatedClock 0:f82994ac4d1b 16
gatedClock 0:f82994ac4d1b 17 if (gtButtons.cLeftButton) // total time increment button.
gatedClock 0:f82994ac4d1b 18 {
gatedClock 0:f82994ac4d1b 19 dMessage = MSG_INC_TIME; // set message.
gatedClock 0:f82994ac4d1b 20 queueModTotalTime.put((int *) dMessage);// pretend it's a pointer.
gatedClock 0:f82994ac4d1b 21 gtButtons.cLeftButton = 0; // clear the button state.
gatedClock 0:f82994ac4d1b 22 }
gatedClock 0:f82994ac4d1b 23
gatedClock 0:f82994ac4d1b 24
gatedClock 0:f82994ac4d1b 25
gatedClock 0:f82994ac4d1b 26 static int dTotalTime = 0; // total time variable.
gatedClock 0:f82994ac4d1b 27 int dMessage; // message.
gatedClock 0:f82994ac4d1b 28 osEvent queueEvent; // queue event.
gatedClock 0:f82994ac4d1b 29
gatedClock 0:f82994ac4d1b 30 while(1) // thread loop.
gatedClock 0:f82994ac4d1b 31 {
gatedClock 0:f82994ac4d1b 32
gatedClock 0:f82994ac4d1b 33 queueEvent = queueModTotalTime.get(1); // get message.
gatedClock 0:f82994ac4d1b 34 if (queueEvent.status == osEventMessage)
gatedClock 0:f82994ac4d1b 35 {
gatedClock 0:f82994ac4d1b 36 dMessage = (int) queueEvent.value.p; // interpret as integer, not pointer.