homework 7

Dependencies:   mbed-rtos mbed C12832_lcd LM75B

Committer:
gatedClock
Date:
Wed Sep 11 20:44:18 2013 +0000
Revision:
69:55b836e8ced7
Parent:
68:cbebcfc948aa
Child:
70:7c0743c28b11
strange that cookRemainingTime is not running at all.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gatedClock 0:fcca4db7b32a 1 /*----------------------------------------------//------------------------------
gatedClock 0:fcca4db7b32a 2 student : m-moore
gatedClock 0:fcca4db7b32a 3 class : rtos
gatedClock 10:2b0a9fc39109 4 directory : RTOS_HW_07
gatedClock 0:fcca4db7b32a 5 file : main.cpp
gatedClock 0:fcca4db7b32a 6 ----description---------------------------------//------------------------------
gatedClock 0:fcca4db7b32a 7 -----includes-----------------------------------//----------------------------*/
gatedClock 0:fcca4db7b32a 8 #include "mbed.h" // mbed class.
gatedClock 10:2b0a9fc39109 9 #include "rtos.h" // rtos class.
gatedClock 39:4e7e4d935a87 10 #include "LM75B.h" // thermometer class.
gatedClock 10:2b0a9fc39109 11 #include "C12832_lcd.h" // LCD class.
gatedClock 0:fcca4db7b32a 12 //---defines------------------------------------//------------------------------
gatedClock 9:cfdb9aa5857c 13 #define LCD1 lcd.locate(0, 0); // LCD line 1.
gatedClock 9:cfdb9aa5857c 14 #define LCD2 lcd.locate(0,11); // LCD line 2.
gatedClock 9:cfdb9aa5857c 15 #define LCD3 lcd.locate(0,22); // LCD line 3.
gatedClock 9:cfdb9aa5857c 16
gatedClock 10:2b0a9fc39109 17
gatedClock 66:4a0006fa5cc1 18 #define DEBOUNCEmS 16 // debounce wait in mS.
gatedClock 19:92b11e30aaaf 19 #define uS_TIMEOUT 100 // Timer uS timeout.
gatedClock 19:92b11e30aaaf 20 #define LBSIG 1 // left button signal code.
gatedClock 33:34c1bef3c4ff 21 #define PIPEuS 1000 // pipeline clock period.
gatedClock 19:92b11e30aaaf 22 #define SLOWCLOCKuS 500000 // slow-clock period.
gatedClock 39:4e7e4d935a87 23 #define TEMPCLOCKS 1 // temperature-measuring period in S.
gatedClock 26:bff592483cb1 24 #define PIPEDATASIZE 8 // dimension of tPipeData.
gatedClock 44:d16e813e61ef 25 #define THREAD_1_WAITmS 400 // thread 1 wait in mS.
gatedClock 67:1d9c85a4c3c1 26 #define THREAD_2_WAITmS 20 // LCD thread wait.
gatedClock 67:1d9c85a4c3c1 27 #define THREAD_3_WAITmS 80 // thread 3 wait in mS.
gatedClock 66:4a0006fa5cc1 28 #define THREAD_4_WAITmS 1 // thread 4 wait in mS.
gatedClock 57:0432c68ad232 29 #define THREAD_5_WAITmS 400 // thread 5 wait in mS.
gatedClock 44:d16e813e61ef 30 #define HB_MODULO 1024 // heartbeat modulo divisor.
gatedClock 50:2928c3cbdcc3 31
gatedClock 54:b0e7352d2516 32 #define MSG_INC_TIME 0x01
gatedClock 54:b0e7352d2516 33 #define MSG_DEC_TIME 0x02
gatedClock 58:ec630b6dd9b1 34 #define MSG_START 0x04
gatedClock 58:ec630b6dd9b1 35 #define MSG_STOP 0x08
gatedClock 58:ec630b6dd9b1 36 #define MSG_OPEN 0x10
gatedClock 58:ec630b6dd9b1 37 #define MSG_CLOSED 0x20
gatedClock 57:0432c68ad232 38
gatedClock 57:0432c68ad232 39 #define FSM_IDLE 0x00 // cook-state state-machine.
gatedClock 57:0432c68ad232 40 #define FSM_COOK 0x01 // cook-state state-machine.
gatedClock 57:0432c68ad232 41 #define FSM_PAUSE 0x02 // cook-state state-machine.
gatedClock 57:0432c68ad232 42 #define FSM_DONE 0x04 // cook-state state-machine.
gatedClock 65:e39360da5929 43
gatedClock 65:e39360da5929 44 #define DEBUG1 // debug preprocessor control.
gatedClock 0:fcca4db7b32a 45 //--global_definitions--------------------------//------------------------------
gatedClock 26:bff592483cb1 46 struct tButtons // button ISR updates.
gatedClock 26:bff592483cb1 47 {
gatedClock 26:bff592483cb1 48 char cLeftButton; // cooktime +60S.
gatedClock 26:bff592483cb1 49 char cRightButton; // cooktime -60S.
gatedClock 26:bff592483cb1 50 char cTopButton; // start cook.
gatedClock 26:bff592483cb1 51 char cBottomButton; // stop cook.
gatedClock 58:ec630b6dd9b1 52 char cCenterButton; // center button pressed.
gatedClock 53:8c2baf5623c8 53 char cDoorOpen; // door open.
gatedClock 26:bff592483cb1 54 };
gatedClock 34:b449d2a7c786 55
gatedClock 61:8026a9fc0cf1 56 Queue<int, 1> queueModTotalTime; // message to modify total time.
gatedClock 61:8026a9fc0cf1 57 Queue<int, 1> queueUpdateFSM; // message to inform FSM.
gatedClock 61:8026a9fc0cf1 58 Queue<int, 1> queueUpdateRemainingTime; // message to update remaining time.
gatedClock 65:e39360da5929 59 Queue<int, 1> queueSetRemainingTime; // tell countdown it's start time.
gatedClock 69:55b836e8ced7 60 Queue<int, 1> queueFSMnewState; // latest FSM state.
gatedClock 0:fcca4db7b32a 61 //--global_variables----------------------------//------------------------------
gatedClock 26:bff592483cb1 62 char gcSignalWaitEnable; // 1 to wait on a signal.
gatedClock 26:bff592483cb1 63 char gcSlowClock; // slow-clock signal.
gatedClock 33:34c1bef3c4ff 64 char gcInitializePipeline; // 1 to initialize pipeline state.
gatedClock 39:4e7e4d935a87 65 float gfCelsius; // from thermometer.
gatedClock 42:266d5bbbfd19 66 float gfLCDcelsius; // feed into LCD.
gatedClock 42:266d5bbbfd19 67 int gdLCDtotalCookTimeSec; // feed into LCD.
gatedClock 42:266d5bbbfd19 68 int gdCookTimeRemainingSec; // feed into LCD.
gatedClock 26:bff592483cb1 69 tButtons gtButtons; // ISR button updates.
gatedClock 0:fcca4db7b32a 70 //--global_instances----------------------------//------------------------------
gatedClock 55:17f3354da63a 71 Serial pc(USBTX, USBRX); // PuTTY terminal communication.
gatedClock 39:4e7e4d935a87 72 LM75B temperature(p28,p27); // on-board thermometer.
gatedClock 9:cfdb9aa5857c 73 C12832_LCD lcd; // LCD object.
gatedClock 53:8c2baf5623c8 74 DigitalOut led0(LED4); // magnetron.
gatedClock 39:4e7e4d935a87 75 DigitalOut led1(LED3);
gatedClock 39:4e7e4d935a87 76 DigitalOut led2(LED2);
gatedClock 39:4e7e4d935a87 77 DigitalOut led3(LED1);
gatedClock 0:fcca4db7b32a 78
gatedClock 0:fcca4db7b32a 79 InterruptIn iJoyStickUp (p15); // joystick up rising edge.
gatedClock 0:fcca4db7b32a 80 InterruptIn iJoyStickDown (p12); // joystick down rising edge.
gatedClock 0:fcca4db7b32a 81 InterruptIn iJoyStickLeft (p13); // joystick left rising edge.
gatedClock 0:fcca4db7b32a 82 InterruptIn iJoyStickRight (p16); // joystick right rising edge.
gatedClock 0:fcca4db7b32a 83 InterruptIn iJoyStickCenter(p14); // 1 if joystick middle pressed.
gatedClock 66:4a0006fa5cc1 84
gatedClock 66:4a0006fa5cc1 85 Timer debounceTimer; // button debounce timer.
gatedClock 0:fcca4db7b32a 86
gatedClock 50:2928c3cbdcc3 87 Ticker tickerButtonStateManager; // manage the button states.
gatedClock 19:92b11e30aaaf 88 Ticker tickerSlowClock; // generate a ~1Hz clock.
gatedClock 64:255295f1d782 89 Ticker tickerCookCountdown; // remaining cook time.
gatedClock 63:63f362bcc2ac 90
gatedClock 63:63f362bcc2ac 91 // Timer timerFSMdone; // duration of FSM 'done' state.
gatedClock 40:7afff79f0d8b 92
gatedClock 0:fcca4db7b32a 93 //-------prototypes-----------------------------//------------------------------
gatedClock 49:56f790977983 94
gatedClock 19:92b11e30aaaf 95 void slowClock(); // 1Hz or thereabouts.
gatedClock 49:56f790977983 96
gatedClock 9:cfdb9aa5857c 97 void initialization(); // initialize settings.
gatedClock 13:21f27ba467c2 98
gatedClock 13:21f27ba467c2 99 void ISRleftButtonRising(); // cook-time increase.
gatedClock 13:21f27ba467c2 100 void ISRleftButtonFalling(); // button-release debounce.
gatedClock 13:21f27ba467c2 101 void ISRrightButtonRising(); // cook-time decrease.
gatedClock 13:21f27ba467c2 102 void ISRrightButtonFalling(); // button-release debounce.
gatedClock 13:21f27ba467c2 103 void ISRtopButtonRising(); // cook start.
gatedClock 13:21f27ba467c2 104 void ISRtopButtonFalling(); // button-release debounce.
gatedClock 13:21f27ba467c2 105 void ISRbottomButtonRising(); // cook stop.
gatedClock 13:21f27ba467c2 106 void ISRbottomButtonFalling(); // button-release debounce.
gatedClock 13:21f27ba467c2 107 void ISRcenterButtonRising(); // door state toggle.
gatedClock 13:21f27ba467c2 108 void ISRcenterButtonFalling(); // button-release debounce.
gatedClock 16:db7f0b3b2605 109 void disableSignalWaiting(); // break from signal waiting.
gatedClock 39:4e7e4d935a87 110
gatedClock 54:b0e7352d2516 111 void threadButtonStateManager(void const *args);
gatedClock 50:2928c3cbdcc3 112 void threadTotalTimeControl(void const *args);
gatedClock 57:0432c68ad232 113 void threadCookStateFSM(void const *args);
gatedClock 64:255295f1d782 114 void cookRemainingTime(); // remaining time countdown.
gatedClock 50:2928c3cbdcc3 115
gatedClock 40:7afff79f0d8b 116 void temperatureThread(void const *args); // temperature measurement.
gatedClock 42:266d5bbbfd19 117 void LCDthread (void const *args); // LCD display thread.
gatedClock 0:fcca4db7b32a 118 //==============================================//==============================
gatedClock 0:fcca4db7b32a 119 int main(void)
gatedClock 0:fcca4db7b32a 120 {
gatedClock 16:db7f0b3b2605 121 char cLeftButtonState; // 1 means button was pressed.
gatedClock 16:db7f0b3b2605 122
gatedClock 16:db7f0b3b2605 123
gatedClock 16:db7f0b3b2605 124
gatedClock 14:d3bb343cd5b2 125 iJoyStickLeft.rise (&ISRleftButtonRising);
gatedClock 14:d3bb343cd5b2 126 iJoyStickLeft.fall (&ISRleftButtonFalling);
gatedClock 9:cfdb9aa5857c 127
gatedClock 14:d3bb343cd5b2 128 iJoyStickRight.rise(&ISRrightButtonRising);
gatedClock 14:d3bb343cd5b2 129 iJoyStickRight.fall(&ISRrightButtonFalling);
gatedClock 14:d3bb343cd5b2 130
gatedClock 14:d3bb343cd5b2 131 iJoyStickUp.rise (&ISRtopButtonRising);
gatedClock 14:d3bb343cd5b2 132 iJoyStickUp.fall (&ISRtopButtonFalling);
gatedClock 9:cfdb9aa5857c 133
gatedClock 14:d3bb343cd5b2 134 iJoyStickDown.rise (&ISRbottomButtonRising);
gatedClock 14:d3bb343cd5b2 135 iJoyStickDown.fall (&ISRbottomButtonFalling);
gatedClock 7:9fbd1d540863 136
gatedClock 14:d3bb343cd5b2 137 iJoyStickCenter.rise(&ISRcenterButtonRising);
gatedClock 14:d3bb343cd5b2 138 iJoyStickCenter.fall(&ISRcenterButtonFalling);
gatedClock 9:cfdb9aa5857c 139
gatedClock 66:4a0006fa5cc1 140 debounceTimer.start(); // kick-off debounce timer.
gatedClock 66:4a0006fa5cc1 141
gatedClock 33:34c1bef3c4ff 142 gcInitializePipeline = 1; // tell pipeline to initialize.
gatedClock 16:db7f0b3b2605 143
gatedClock 9:cfdb9aa5857c 144 initialization(); // initialize variables.
gatedClock 21:b794d189c36b 145 gcSlowClock = 0;
gatedClock 44:d16e813e61ef 146 led1 = 0;
gatedClock 53:8c2baf5623c8 147 gtButtons.cDoorOpen = 0; // initialize with door closed.
gatedClock 63:63f362bcc2ac 148
gatedClock 63:63f362bcc2ac 149 // timerFSMdone.start(); // start 'done' timer.
gatedClock 49:56f790977983 150
gatedClock 69:55b836e8ced7 151 // tickerSlowClock.attach_us(&slowClock ,SLOWCLOCKuS);
gatedClock 64:255295f1d782 152
gatedClock 64:255295f1d782 153 // count-down by one second.
gatedClock 69:55b836e8ced7 154 pc.printf("\n\r starting cookRemainingTime");
gatedClock 69:55b836e8ced7 155 tickerCookCountdown.attach(&cookRemainingTime,1);
gatedClock 54:b0e7352d2516 156
gatedClock 40:7afff79f0d8b 157
gatedClock 69:55b836e8ced7 158 // Thread thread_1(temperatureThread ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
gatedClock 69:55b836e8ced7 159 // Thread thread_2(LCDthread ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
gatedClock 69:55b836e8ced7 160 // Thread thread_3(threadTotalTimeControl ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
gatedClock 69:55b836e8ced7 161 // Thread thread_4(threadButtonStateManager,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL); // was osPriorityIdle
gatedClock 69:55b836e8ced7 162 // Thread thread_5(threadCookStateFSM ,NULL,osPriorityIdle,DEFAULT_STACK_SIZE,NULL);
gatedClock 69:55b836e8ced7 163 //
gatedClock 66:4a0006fa5cc1 164 //Thread thread_4(threadButtonStateManager);
gatedClock 52:8ba6a0c91a89 165
gatedClock 40:7afff79f0d8b 166
gatedClock 59:5e45b5e4a874 167 // the message-receiving threads need 'else' for message-receive-timeout.
gatedClock 9:cfdb9aa5857c 168
gatedClock 14:d3bb343cd5b2 169 while(1)
gatedClock 0:fcca4db7b32a 170 {
gatedClock 44:d16e813e61ef 171 Thread::wait(10000);
gatedClock 16:db7f0b3b2605 172
gatedClock 16:db7f0b3b2605 173
gatedClock 16:db7f0b3b2605 174
gatedClock 14:d3bb343cd5b2 175
gatedClock 0:fcca4db7b32a 176 }
gatedClock 19:92b11e30aaaf 177 }
gatedClock 19:92b11e30aaaf 178 /*----------------------------------------------//----------------------------*/
gatedClock 59:5e45b5e4a874 179
gatedClock 59:5e45b5e4a874 180 // this serves as the bottom-half for all of the button-press IRSs.
gatedClock 59:5e45b5e4a874 181 // it sends button-status messages to other threads, and it also
gatedClock 59:5e45b5e4a874 182 // clears the button-state globals to prepare them for the next
gatedClock 59:5e45b5e4a874 183 // button press.
gatedClock 59:5e45b5e4a874 184
gatedClock 59:5e45b5e4a874 185
gatedClock 54:b0e7352d2516 186 void threadButtonStateManager(void const *args)
gatedClock 50:2928c3cbdcc3 187 {
gatedClock 56:18cff6eb91db 188 int dMessage; // message.
gatedClock 50:2928c3cbdcc3 189
gatedClock 54:b0e7352d2516 190 while(1) // thread loop.
gatedClock 67:1d9c85a4c3c1 191 {
gatedClock 54:b0e7352d2516 192 //--- // TOTAL TIME CONTROL.
gatedClock 56:18cff6eb91db 193
gatedClock 56:18cff6eb91db 194 // encoded integers will be sent,
gatedClock 56:18cff6eb91db 195 // not pointers.
gatedClock 50:2928c3cbdcc3 196
gatedClock 50:2928c3cbdcc3 197 if (gtButtons.cLeftButton) // total time increment button.
gatedClock 50:2928c3cbdcc3 198 {
gatedClock 54:b0e7352d2516 199 dMessage = MSG_INC_TIME; // set message.
gatedClock 69:55b836e8ced7 200 queueModTotalTime.put((int *) dMessage,1);// pretend it's a pointer.
gatedClock 50:2928c3cbdcc3 201 gtButtons.cLeftButton = 0; // clear the button state.
gatedClock 67:1d9c85a4c3c1 202 // pc.printf("\n\r time increment button.");
gatedClock 50:2928c3cbdcc3 203 }
gatedClock 67:1d9c85a4c3c1 204
gatedClock 59:5e45b5e4a874 205 if (gtButtons.cRightButton) // total time decrement button.
gatedClock 50:2928c3cbdcc3 206 {
gatedClock 54:b0e7352d2516 207 dMessage = MSG_DEC_TIME; // set message.
gatedClock 69:55b836e8ced7 208 queueModTotalTime.put((int *) dMessage,1);// pretend it's a pointer.
gatedClock 50:2928c3cbdcc3 209 gtButtons.cRightButton = 0; // clear the button state.
gatedClock 67:1d9c85a4c3c1 210 // pc.printf("\n\r time decrement button.");
gatedClock 50:2928c3cbdcc3 211 }
gatedClock 67:1d9c85a4c3c1 212
gatedClock 59:5e45b5e4a874 213 //--- // COOK-STATE FSM.
gatedClock 59:5e45b5e4a874 214
gatedClock 59:5e45b5e4a874 215 if (gtButtons.cTopButton) // start-cook button.
gatedClock 58:ec630b6dd9b1 216 {
gatedClock 59:5e45b5e4a874 217 dMessage = MSG_START; // set message.
gatedClock 69:55b836e8ced7 218 queueUpdateFSM.put((int *) dMessage,1); // pretend it's a pointer.
gatedClock 59:5e45b5e4a874 219 gtButtons.cTopButton = 0; // clear the button state.
gatedClock 58:ec630b6dd9b1 220 }
gatedClock 67:1d9c85a4c3c1 221
gatedClock 59:5e45b5e4a874 222 if (gtButtons.cBottomButton) // stop-cook button.
gatedClock 58:ec630b6dd9b1 223 {
gatedClock 59:5e45b5e4a874 224 dMessage = MSG_STOP; // set message.
gatedClock 69:55b836e8ced7 225 queueUpdateFSM.put((int *) dMessage,1); // pretend it's a pointer.
gatedClock 59:5e45b5e4a874 226 gtButtons.cBottomButton = 0; // clear the button state.
gatedClock 58:ec630b6dd9b1 227 }
gatedClock 67:1d9c85a4c3c1 228
gatedClock 59:5e45b5e4a874 229 if (gtButtons.cCenterButton) // door-state-toggle.
gatedClock 58:ec630b6dd9b1 230 {
gatedClock 59:5e45b5e4a874 231 dMessage = gtButtons.cDoorOpen; // determined in ISR.
gatedClock 69:55b836e8ced7 232 queueUpdateFSM.put((int *) dMessage,1); // pretend it's a pointer.
gatedClock 59:5e45b5e4a874 233 gtButtons.cCenterButton = 0; // clear the button state.
gatedClock 58:ec630b6dd9b1 234 }
gatedClock 59:5e45b5e4a874 235 //---
gatedClock 58:ec630b6dd9b1 236
gatedClock 54:b0e7352d2516 237 Thread::wait(THREAD_4_WAITmS); // multitasking.
gatedClock 54:b0e7352d2516 238 } // thread loop.
gatedClock 54:b0e7352d2516 239 } // threadButtonStateManager.
gatedClock 50:2928c3cbdcc3 240 /*----------------------------------------------//----------------------------*/
gatedClock 51:e5ec74c49b01 241 // the incoming messages are mutually-exclusive.
gatedClock 51:e5ec74c49b01 242 // total time controller.
gatedClock 51:e5ec74c49b01 243 void threadTotalTimeControl(void const *args)
gatedClock 50:2928c3cbdcc3 244 {
gatedClock 51:e5ec74c49b01 245 static int dTotalTime = 0; // total time variable.
gatedClock 60:e10bf95bbc96 246 int dMessage; // message.
gatedClock 51:e5ec74c49b01 247 osEvent queueEvent; // queue event.
gatedClock 50:2928c3cbdcc3 248
gatedClock 50:2928c3cbdcc3 249 while(1) // thread loop.
gatedClock 50:2928c3cbdcc3 250 {
gatedClock 50:2928c3cbdcc3 251
gatedClock 55:17f3354da63a 252 queueEvent = queueModTotalTime.get(1); // get message.
gatedClock 51:e5ec74c49b01 253 if (queueEvent.status == osEventMessage)
gatedClock 51:e5ec74c49b01 254 {
gatedClock 56:18cff6eb91db 255 dMessage = (int) queueEvent.value.p; // interpret as integer, not pointer.
gatedClock 54:b0e7352d2516 256
gatedClock 54:b0e7352d2516 257 // increment total time.
gatedClock 56:18cff6eb91db 258 if (dMessage == MSG_INC_TIME) dTotalTime += 60;
gatedClock 54:b0e7352d2516 259
gatedClock 54:b0e7352d2516 260 // decrement total time.
gatedClock 56:18cff6eb91db 261 if (dMessage == MSG_DEC_TIME) dTotalTime -= 60;
gatedClock 65:e39360da5929 262
gatedClock 65:e39360da5929 263 // saturations.
gatedClock 65:e39360da5929 264 if (dTotalTime > 180) dTotalTime = 180;
gatedClock 65:e39360da5929 265 if (dTotalTime < 0) dTotalTime = 0;
gatedClock 65:e39360da5929 266
gatedClock 69:55b836e8ced7 267 queueSetRemainingTime.put((int *) dTotalTime,1);
gatedClock 65:e39360da5929 268
gatedClock 65:e39360da5929 269
gatedClock 51:e5ec74c49b01 270 }
gatedClock 54:b0e7352d2516 271
gatedClock 65:e39360da5929 272
gatedClock 51:e5ec74c49b01 273
gatedClock 51:e5ec74c49b01 274 gdLCDtotalCookTimeSec = dTotalTime; // transmit to LCD.
gatedClock 61:8026a9fc0cf1 275
gatedClock 61:8026a9fc0cf1 276 // pretend it's a pointer.
gatedClock 61:8026a9fc0cf1 277 // queueUpdateTotalTime.put((int *) dTotalTime);
gatedClock 61:8026a9fc0cf1 278
gatedClock 61:8026a9fc0cf1 279
gatedClock 50:2928c3cbdcc3 280
gatedClock 50:2928c3cbdcc3 281 Thread::wait(THREAD_3_WAITmS); // multitasking.
gatedClock 50:2928c3cbdcc3 282 } // thread loop.
gatedClock 50:2928c3cbdcc3 283 } // threadTotalTimeControl.
gatedClock 33:34c1bef3c4ff 284 /*----------------------------------------------//----------------------------*/
gatedClock 60:e10bf95bbc96 285 /*
gatedClock 60:e10bf95bbc96 286 #define FSM_IDLE 0x00 // cook-state state-machine.
gatedClock 60:e10bf95bbc96 287 #define FSM_COOK 0x01 // cook-state state-machine.
gatedClock 60:e10bf95bbc96 288 #define FSM_PAUSE 0x02 // cook-state state-machine.
gatedClock 60:e10bf95bbc96 289 #define FSM_DONE 0x04 // cook-state state-machine.
gatedClock 62:48e7c196e2a5 290
gatedClock 62:48e7c196e2a5 291 #define MSG_START 0x04
gatedClock 62:48e7c196e2a5 292 #define MSG_STOP 0x08
gatedClock 62:48e7c196e2a5 293 #define MSG_OPEN 0x10
gatedClock 62:48e7c196e2a5 294 #define MSG_CLOSED 0x20
gatedClock 60:e10bf95bbc96 295 */
gatedClock 57:0432c68ad232 296 void threadCookStateFSM(void const *args) // cook-cycle FSM.
gatedClock 57:0432c68ad232 297 {
gatedClock 69:55b836e8ced7 298 static int dFSMstate = FSM_IDLE; // state of this FSM.
gatedClock 69:55b836e8ced7 299 static int dFSMstateLast = FSM_IDLE; // previous FSM state.
gatedClock 61:8026a9fc0cf1 300 static int dButtonState; // received button state.
gatedClock 61:8026a9fc0cf1 301 static int dRemainingTime; // received remaining time.
gatedClock 62:48e7c196e2a5 302
gatedClock 62:48e7c196e2a5 303 static int dButtonStart = 0;
gatedClock 62:48e7c196e2a5 304 static int dButtonStop = 0;
gatedClock 62:48e7c196e2a5 305 static int dDoorOpen = 0;
gatedClock 62:48e7c196e2a5 306 static int dTimeRemaining = 0;
gatedClock 62:48e7c196e2a5 307
gatedClock 63:63f362bcc2ac 308 osEvent queueEvent; // queue event.
gatedClock 63:63f362bcc2ac 309
gatedClock 57:0432c68ad232 310 while(1) // thread loop.
gatedClock 57:0432c68ad232 311 {
gatedClock 62:48e7c196e2a5 312
gatedClock 63:63f362bcc2ac 313 if (dFSMstate == FSM_IDLE) // idle state.
gatedClock 62:48e7c196e2a5 314 {
gatedClock 69:55b836e8ced7 315 // pc.printf("\n\r FSM_IDLE");
gatedClock 62:48e7c196e2a5 316 if (dButtonStart & !dDoorOpen & dTimeRemaining) dFSMstate = FSM_COOK;
gatedClock 62:48e7c196e2a5 317 }
gatedClock 62:48e7c196e2a5 318 else
gatedClock 63:63f362bcc2ac 319 if (dFSMstate == FSM_COOK) // cook state.
gatedClock 62:48e7c196e2a5 320 {
gatedClock 68:cbebcfc948aa 321 pc.printf("\n\r FSM_COOK");
gatedClock 68:cbebcfc948aa 322 if (dDoorOpen & dTimeRemaining) dFSMstate = FSM_PAUSE;
gatedClock 62:48e7c196e2a5 323 }
gatedClock 62:48e7c196e2a5 324 else
gatedClock 63:63f362bcc2ac 325 if (dFSMstate == FSM_PAUSE) // pause state.
gatedClock 62:48e7c196e2a5 326 {
gatedClock 68:cbebcfc948aa 327 pc.printf("\n\r FSM_PAUSE");
gatedClock 62:48e7c196e2a5 328 if (dButtonStart & !dDoorOpen & dTimeRemaining) dFSMstate = FSM_DONE;
gatedClock 62:48e7c196e2a5 329 if (dButtonStop) dFSMstate = FSM_COOK;
gatedClock 62:48e7c196e2a5 330 }
gatedClock 62:48e7c196e2a5 331 else
gatedClock 62:48e7c196e2a5 332 if (dFSMstate == FSM_DONE) // incomplete.
gatedClock 62:48e7c196e2a5 333 {
gatedClock 68:cbebcfc948aa 334 pc.printf("\n\r FSM_DONE");
gatedClock 63:63f362bcc2ac 335 // timerFSMdone.reset(); // reset the timer.
gatedClock 63:63f362bcc2ac 336 dFSMstate = FSM_IDLE; // end of beep.
gatedClock 62:48e7c196e2a5 337 }
gatedClock 62:48e7c196e2a5 338
gatedClock 69:55b836e8ced7 339
gatedClock 69:55b836e8ced7 340 if (dFSMstate != dFSMstateLast) // if just changed state.
gatedClock 69:55b836e8ced7 341 {
gatedClock 69:55b836e8ced7 342 // tell cookRemainingTime the new state.
gatedClock 69:55b836e8ced7 343 queueFSMnewState.put((int* )dFSMstate,1);
gatedClock 69:55b836e8ced7 344
gatedClock 69:55b836e8ced7 345
gatedClock 69:55b836e8ced7 346 }
gatedClock 62:48e7c196e2a5 347
gatedClock 63:63f362bcc2ac 348
gatedClock 60:e10bf95bbc96 349 queueEvent = queueUpdateFSM.get(1); // get message.
gatedClock 60:e10bf95bbc96 350 if (queueEvent.status == osEventMessage)// update state variable.
gatedClock 60:e10bf95bbc96 351 {
gatedClock 61:8026a9fc0cf1 352 // interpret as integer, not pointer.
gatedClock 61:8026a9fc0cf1 353 dButtonState = (int) queueEvent.value.p;
gatedClock 63:63f362bcc2ac 354
gatedClock 69:55b836e8ced7 355 pc.printf("\n dButtonState = %d",dButtonState);
gatedClock 69:55b836e8ced7 356
gatedClock 63:63f362bcc2ac 357 if (dButtonState == MSG_START)
gatedClock 63:63f362bcc2ac 358 {
gatedClock 69:55b836e8ced7 359 pc.printf("\n\r message start.");
gatedClock 63:63f362bcc2ac 360 dButtonStart = 1;
gatedClock 63:63f362bcc2ac 361 dButtonStop = 0;
gatedClock 63:63f362bcc2ac 362 }
gatedClock 63:63f362bcc2ac 363 if (dButtonState == MSG_STOP)
gatedClock 63:63f362bcc2ac 364 {
gatedClock 69:55b836e8ced7 365 pc.printf("\n\r message stop.");
gatedClock 63:63f362bcc2ac 366 dButtonStart = 0;
gatedClock 63:63f362bcc2ac 367 dButtonStop = 1;
gatedClock 63:63f362bcc2ac 368 }
gatedClock 63:63f362bcc2ac 369
gatedClock 63:63f362bcc2ac 370 if (dButtonState == MSG_OPEN)
gatedClock 63:63f362bcc2ac 371 {
gatedClock 69:55b836e8ced7 372 pc.printf("\n\r message open.");
gatedClock 63:63f362bcc2ac 373 dDoorOpen = 1;
gatedClock 63:63f362bcc2ac 374 }
gatedClock 63:63f362bcc2ac 375
gatedClock 63:63f362bcc2ac 376 if (dButtonState == MSG_CLOSED)
gatedClock 63:63f362bcc2ac 377 {
gatedClock 69:55b836e8ced7 378 pc.printf("\n\r message closed.");
gatedClock 63:63f362bcc2ac 379 dDoorOpen = 0;
gatedClock 63:63f362bcc2ac 380 }
gatedClock 63:63f362bcc2ac 381
gatedClock 61:8026a9fc0cf1 382 }
gatedClock 61:8026a9fc0cf1 383 // get message.
gatedClock 61:8026a9fc0cf1 384 queueEvent = queueUpdateRemainingTime.get(1);
gatedClock 61:8026a9fc0cf1 385 if (queueEvent.status == osEventMessage)// update state variable.
gatedClock 61:8026a9fc0cf1 386 {
gatedClock 61:8026a9fc0cf1 387 // interpret as integer, not pointer.
gatedClock 61:8026a9fc0cf1 388 dRemainingTime = (int) queueEvent.value.p;
gatedClock 69:55b836e8ced7 389
gatedClock 61:8026a9fc0cf1 390 }
gatedClock 60:e10bf95bbc96 391
gatedClock 60:e10bf95bbc96 392
gatedClock 61:8026a9fc0cf1 393
gatedClock 57:0432c68ad232 394
gatedClock 57:0432c68ad232 395
gatedClock 57:0432c68ad232 396
gatedClock 57:0432c68ad232 397
gatedClock 69:55b836e8ced7 398 dFSMstateLast = dFSMstate; // pipeline variable.
gatedClock 57:0432c68ad232 399 Thread::wait(THREAD_5_WAITmS); // multitasking.
gatedClock 57:0432c68ad232 400 } // thread loop.
gatedClock 57:0432c68ad232 401 } // threadCookStateFSM.
gatedClock 57:0432c68ad232 402 /*----------------------------------------------//----------------------------*/
gatedClock 19:92b11e30aaaf 403 void slowClock(void) // 1Hz or thereabouts.
gatedClock 19:92b11e30aaaf 404 {
gatedClock 24:d39516e077ea 405 gcSlowClock = !gcSlowClock; // toggle clock.
gatedClock 19:92b11e30aaaf 406 }
gatedClock 19:92b11e30aaaf 407 /*----------------------------------------------//----------------------------*/
gatedClock 0:fcca4db7b32a 408 void initialization(void) // program initializations.
gatedClock 0:fcca4db7b32a 409 {
gatedClock 16:db7f0b3b2605 410 gcSignalWaitEnable = 1;
gatedClock 0:fcca4db7b32a 411 }
gatedClock 0:fcca4db7b32a 412 /*----------------------------------------------//----------------------------*/
gatedClock 26:bff592483cb1 413 void ISRleftButtonRising(void) // cooktime plus 60s.
gatedClock 1:9188d4668a88 414 {
gatedClock 66:4a0006fa5cc1 415 if (debounceTimer.read_ms() > DEBOUNCEmS)
gatedClock 26:bff592483cb1 416 gtButtons.cLeftButton = 1; // detect left button.
gatedClock 9:cfdb9aa5857c 417
gatedClock 66:4a0006fa5cc1 418 debounceTimer.reset(); // begin debounce period.
gatedClock 11:9cae003da12b 419 }
gatedClock 1:9188d4668a88 420 /*----------------------------------------------//----------------------------*/
gatedClock 15:5eaa2ab1d00d 421 void ISRleftButtonFalling(void) // button-release debounce.
gatedClock 1:9188d4668a88 422 {
gatedClock 66:4a0006fa5cc1 423 debounceTimer.reset(); // begin debounce period.
gatedClock 11:9cae003da12b 424 }
gatedClock 2:665ffa57031f 425 /*----------------------------------------------//----------------------------*/
gatedClock 26:bff592483cb1 426 void ISRrightButtonRising(void) // cooktime -60s.
gatedClock 12:e40272e1fd8f 427 {
gatedClock 66:4a0006fa5cc1 428 if (debounceTimer.read_ms() > DEBOUNCEmS)
gatedClock 26:bff592483cb1 429 gtButtons.cRightButton = 1; // detect right button.
gatedClock 12:e40272e1fd8f 430
gatedClock 66:4a0006fa5cc1 431 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 432 }
gatedClock 12:e40272e1fd8f 433 /*----------------------------------------------//----------------------------*/
gatedClock 15:5eaa2ab1d00d 434 void ISRrightButtonFalling(void) // button-release debounce.
gatedClock 12:e40272e1fd8f 435 {
gatedClock 66:4a0006fa5cc1 436 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 437 }
gatedClock 12:e40272e1fd8f 438 /*----------------------------------------------//----------------------------*/
gatedClock 26:bff592483cb1 439 void ISRtopButtonRising(void) // cook start.
gatedClock 12:e40272e1fd8f 440 {
gatedClock 66:4a0006fa5cc1 441 if (debounceTimer.read_ms() > DEBOUNCEmS)
gatedClock 26:bff592483cb1 442 gtButtons.cTopButton = 1; // detect top button.
gatedClock 12:e40272e1fd8f 443
gatedClock 66:4a0006fa5cc1 444 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 445 }
gatedClock 12:e40272e1fd8f 446 /*----------------------------------------------//----------------------------*/
gatedClock 15:5eaa2ab1d00d 447 void ISRtopButtonFalling(void) // button-release debounce.
gatedClock 12:e40272e1fd8f 448 {
gatedClock 66:4a0006fa5cc1 449 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 450 }
gatedClock 12:e40272e1fd8f 451 /*----------------------------------------------//----------------------------*/
gatedClock 53:8c2baf5623c8 452 // front-end control of magnetron off.
gatedClock 53:8c2baf5623c8 453 // due to physical danger, the magnetron is turned off immediately
gatedClock 53:8c2baf5623c8 454 // upon off-button press, in the interrupt that it generates.
gatedClock 53:8c2baf5623c8 455
gatedClock 26:bff592483cb1 456 void ISRbottomButtonRising(void) // cook stop.
gatedClock 12:e40272e1fd8f 457 {
gatedClock 66:4a0006fa5cc1 458 if (debounceTimer.read_ms() > DEBOUNCEmS)
gatedClock 66:4a0006fa5cc1 459 {
gatedClock 66:4a0006fa5cc1 460 led0 = 0; // magnetron off.
gatedClock 66:4a0006fa5cc1 461 gtButtons.cBottomButton = 1; // detect bottom button.
gatedClock 66:4a0006fa5cc1 462 }
gatedClock 66:4a0006fa5cc1 463 debounceTimer.reset(); // begin debounce period.
gatedClock 66:4a0006fa5cc1 464 }
gatedClock 12:e40272e1fd8f 465 /*----------------------------------------------//----------------------------*/
gatedClock 15:5eaa2ab1d00d 466 void ISRbottomButtonFalling(void) // button-release debounce.
gatedClock 12:e40272e1fd8f 467 {
gatedClock 66:4a0006fa5cc1 468 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 469 }
gatedClock 12:e40272e1fd8f 470 /*----------------------------------------------//----------------------------*/
gatedClock 53:8c2baf5623c8 471 // front-end control of magnetron off.
gatedClock 53:8c2baf5623c8 472 // due to physical danger, the magnetron is turned off immediately
gatedClock 53:8c2baf5623c8 473 // upon detection of an open door.
gatedClock 53:8c2baf5623c8 474
gatedClock 26:bff592483cb1 475 void ISRcenterButtonRising(void) // toggle door state.
gatedClock 12:e40272e1fd8f 476 {
gatedClock 66:4a0006fa5cc1 477 if (debounceTimer.read_ms() > DEBOUNCEmS)
gatedClock 66:4a0006fa5cc1 478 {
gatedClock 66:4a0006fa5cc1 479 if (gtButtons.cDoorOpen == MSG_OPEN) // calculate door state.
gatedClock 66:4a0006fa5cc1 480 gtButtons.cDoorOpen = MSG_CLOSED;
gatedClock 66:4a0006fa5cc1 481 else
gatedClock 66:4a0006fa5cc1 482 gtButtons.cDoorOpen = MSG_OPEN;
gatedClock 53:8c2baf5623c8 483
gatedClock 59:5e45b5e4a874 484 // magnetron off.
gatedClock 66:4a0006fa5cc1 485 if (gtButtons.cDoorOpen == MSG_OPEN) led0 = 0;
gatedClock 58:ec630b6dd9b1 486
gatedClock 66:4a0006fa5cc1 487 gtButtons.cCenterButton = 1;
gatedClock 66:4a0006fa5cc1 488 }
gatedClock 66:4a0006fa5cc1 489 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 490 }
gatedClock 12:e40272e1fd8f 491 /*----------------------------------------------//----------------------------*/
gatedClock 15:5eaa2ab1d00d 492 void ISRcenterButtonFalling(void) // button-release debounce.
gatedClock 12:e40272e1fd8f 493 {
gatedClock 66:4a0006fa5cc1 494 debounceTimer.reset(); // begin debounce period.
gatedClock 12:e40272e1fd8f 495 }
gatedClock 12:e40272e1fd8f 496 /*----------------------------------------------//----------------------------*/
gatedClock 40:7afff79f0d8b 497 void temperatureThread(void const *args) // temperature measurement.
gatedClock 39:4e7e4d935a87 498 {
gatedClock 45:e3207684e841 499 while(1) // thread loop.
gatedClock 45:e3207684e841 500 {
gatedClock 45:e3207684e841 501 gfCelsius = temperature.read(); // physical measurement.
gatedClock 40:7afff79f0d8b 502
gatedClock 45:e3207684e841 503 Thread::wait(THREAD_1_WAITmS); // multitasking.
gatedClock 45:e3207684e841 504 } // thread loop.
gatedClock 45:e3207684e841 505 } // temperatureThread.
gatedClock 42:266d5bbbfd19 506 /*----------------------------------------------//----------------------------*/
gatedClock 42:266d5bbbfd19 507 void LCDthread(void const *args) // LCD display thread.
gatedClock 42:266d5bbbfd19 508 {
gatedClock 67:1d9c85a4c3c1 509
gatedClock 67:1d9c85a4c3c1 510 static int dLCDtotalCookTimeSec = 0; // sample current values.
gatedClock 67:1d9c85a4c3c1 511 static int dCookTimeRemainingSec = 0;
gatedClock 67:1d9c85a4c3c1 512 static float fLCDcelsius = 0.0;
gatedClock 67:1d9c85a4c3c1 513
gatedClock 67:1d9c85a4c3c1 514 // remember previous values.
gatedClock 67:1d9c85a4c3c1 515 static int dLCDtotalCookTimeSecLast = 0;
gatedClock 67:1d9c85a4c3c1 516 static int dCookTimeRemainingSecLast = 0;
gatedClock 67:1d9c85a4c3c1 517 static float fLCDcelsiusLast = 0.0;
gatedClock 67:1d9c85a4c3c1 518
gatedClock 44:d16e813e61ef 519 while(1) // thread loop.
gatedClock 44:d16e813e61ef 520 {
gatedClock 67:1d9c85a4c3c1 521 // don't allow the values to
gatedClock 67:1d9c85a4c3c1 522 // change in the middle of the
gatedClock 67:1d9c85a4c3c1 523 // below else the anti-blink
gatedClock 67:1d9c85a4c3c1 524 // code won't work.
gatedClock 67:1d9c85a4c3c1 525 dLCDtotalCookTimeSec = gdLCDtotalCookTimeSec;
gatedClock 67:1d9c85a4c3c1 526 dCookTimeRemainingSec = gdCookTimeRemainingSec;
gatedClock 67:1d9c85a4c3c1 527 fLCDcelsius = gfLCDcelsius;
gatedClock 67:1d9c85a4c3c1 528
gatedClock 67:1d9c85a4c3c1 529
gatedClock 67:1d9c85a4c3c1 530 // clear display only when
gatedClock 67:1d9c85a4c3c1 531 // necessary, in order to avoid
gatedClock 67:1d9c85a4c3c1 532 // 'blinkieness'.
gatedClock 67:1d9c85a4c3c1 533 if (dLCDtotalCookTimeSec != dLCDtotalCookTimeSecLast ||
gatedClock 67:1d9c85a4c3c1 534 dCookTimeRemainingSec != dCookTimeRemainingSecLast ||
gatedClock 67:1d9c85a4c3c1 535 fLCDcelsius != fLCDcelsiusLast)
gatedClock 67:1d9c85a4c3c1 536 lcd.cls();
gatedClock 42:266d5bbbfd19 537
gatedClock 44:d16e813e61ef 538 LCD1; // line 1.
gatedClock 67:1d9c85a4c3c1 539 lcd.printf(" total cook time: %d",dLCDtotalCookTimeSec);
gatedClock 42:266d5bbbfd19 540
gatedClock 44:d16e813e61ef 541 LCD2; // line 2.
gatedClock 67:1d9c85a4c3c1 542 lcd.printf(" remaing cook time: %d",dCookTimeRemainingSec);
gatedClock 42:266d5bbbfd19 543
gatedClock 44:d16e813e61ef 544 LCD3; // line 3.
gatedClock 67:1d9c85a4c3c1 545 lcd.printf(" temperature : %5.3f",fLCDcelsius);
gatedClock 67:1d9c85a4c3c1 546
gatedClock 67:1d9c85a4c3c1 547 // pipeline variables.
gatedClock 67:1d9c85a4c3c1 548 dLCDtotalCookTimeSecLast = dLCDtotalCookTimeSec;
gatedClock 67:1d9c85a4c3c1 549 dCookTimeRemainingSecLast = dCookTimeRemainingSec;
gatedClock 67:1d9c85a4c3c1 550 fLCDcelsiusLast = fLCDcelsius;
gatedClock 42:266d5bbbfd19 551
gatedClock 44:d16e813e61ef 552 Thread::wait(THREAD_2_WAITmS); // multitasking.
gatedClock 44:d16e813e61ef 553 } // thread loop.
gatedClock 44:d16e813e61ef 554 } // LCDthread.
gatedClock 42:266d5bbbfd19 555 /*----------------------------------------------//----------------------------*/
gatedClock 64:255295f1d782 556 void cookRemainingTime(void) // cook-cycle countdown.
gatedClock 64:255295f1d782 557 {
gatedClock 69:55b836e8ced7 558 static int dFSMstate = FSM_IDLE; // mirror FSM state.
gatedClock 69:55b836e8ced7 559 static int dTotalTime = 0; // local copy, total time.
gatedClock 65:e39360da5929 560 static int dRemainingTime = 0; // remaining time.
gatedClock 65:e39360da5929 561 osEvent queueEvent; // queue event.
gatedClock 69:55b836e8ced7 562
gatedClock 69:55b836e8ced7 563 pc.printf("\n\r cookRemainingTime.");
gatedClock 69:55b836e8ced7 564 if (0)
gatedClock 69:55b836e8ced7 565 {
gatedClock 69:55b836e8ced7 566
gatedClock 69:55b836e8ced7 567 // count-down while FSM is in cook mode.
gatedClock 69:55b836e8ced7 568 if (dFSMstate == FSM_COOK) dRemainingTime--;
gatedClock 66:4a0006fa5cc1 569
gatedClock 69:55b836e8ced7 570 // if done, including if stop button
gatedClock 69:55b836e8ced7 571 // was presed.
gatedClock 69:55b836e8ced7 572 if (dFSMstate == FSM_DONE) dRemainingTime = 0;
gatedClock 69:55b836e8ced7 573
gatedClock 69:55b836e8ced7 574 // saturate remaining time.
gatedClock 65:e39360da5929 575 if (dRemainingTime < 0) dRemainingTime = 0;
gatedClock 69:55b836e8ced7 576
gatedClock 69:55b836e8ced7 577 // send to FSM.
gatedClock 69:55b836e8ced7 578 queueUpdateRemainingTime.put((int *) dRemainingTime,1);
gatedClock 66:4a0006fa5cc1 579
gatedClock 65:e39360da5929 580
gatedClock 69:55b836e8ced7 581 pc.printf("\n\r dRemainingTime = %d",dRemainingTime);
gatedClock 65:e39360da5929 582
gatedClock 69:55b836e8ced7 583
gatedClock 65:e39360da5929 584 queueEvent = queueSetRemainingTime.get(1);
gatedClock 65:e39360da5929 585 if (queueEvent.status == osEventMessage) // update state variable.
gatedClock 65:e39360da5929 586 {
gatedClock 69:55b836e8ced7 587
gatedClock 65:e39360da5929 588 // interpret as integer, not pointer.
gatedClock 69:55b836e8ced7 589 dTotalTime = (int) queueEvent.value.p;
gatedClock 69:55b836e8ced7 590
gatedClock 69:55b836e8ced7 591 pc.printf("\n\r dTotalTime = %d",dTotalTime);
gatedClock 65:e39360da5929 592 }
gatedClock 69:55b836e8ced7 593
gatedClock 69:55b836e8ced7 594
gatedClock 69:55b836e8ced7 595
gatedClock 69:55b836e8ced7 596 queueEvent = queueFSMnewState.get(1); // get latest FSM state.
gatedClock 69:55b836e8ced7 597 if (queueEvent.status == osEventMessage) // if there is an FSM change.
gatedClock 69:55b836e8ced7 598 {
gatedClock 69:55b836e8ced7 599 dFSMstate = (int) queueEvent.value.p; // mirror the FSM state.
gatedClock 69:55b836e8ced7 600
gatedClock 69:55b836e8ced7 601
gatedClock 69:55b836e8ced7 602 if (dFSMstate == FSM_COOK) // if FSM just entered cook mode.
gatedClock 69:55b836e8ced7 603 {
gatedClock 69:55b836e8ced7 604 dRemainingTime = dTotalTime; // rewind countdown.
gatedClock 69:55b836e8ced7 605 }
gatedClock 69:55b836e8ced7 606
gatedClock 69:55b836e8ced7 607 }
gatedClock 69:55b836e8ced7 608 }
gatedClock 64:255295f1d782 609 }
gatedClock 69:55b836e8ced7 610 /*----------------------------------------------//----------------------------*/
gatedClock 69:55b836e8ced7 611
gatedClock 69:55b836e8ced7 612
gatedClock 69:55b836e8ced7 613
gatedClock 69:55b836e8ced7 614
gatedClock 69:55b836e8ced7 615
gatedClock 69:55b836e8ced7 616
gatedClock 69:55b836e8ced7 617
gatedClock 69:55b836e8ced7 618
gatedClock 69:55b836e8ced7 619
gatedClock 69:55b836e8ced7 620
gatedClock 69:55b836e8ced7 621