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: mbed mbed-rtos TextLCD
Interface.cpp
00001 #include "Interface.hpp" //Include the header file, this acts like a series of forward declarations 00002 //Constructor 00003 INTERFACE::INTERFACE(){}//Set all values to 0 00004 INTERFACE::~INTERFACE(){} //Destructor 00005 void INTERFACE::Interface_Init(int turns)//Set all values to 0 bar the default turns 00006 { 00007 Led_Select_Left_mutex.lock(); 00008 Led_Select_Left = 0; 00009 Led_Select_Left_mutex.unlock(); 00010 00011 Led_Select_Right_mutex.lock(); 00012 Led_Select_Right= 0; 00013 Led_Select_Right_mutex.unlock(); 00014 00015 _Twist_Go_mutex.lock(); 00016 _Twist_Go =0; 00017 _Twist_Go_mutex.unlock(); 00018 00019 _Anneal_Go_mutex.lock(); 00020 _Anneal_Go =0; 00021 _Anneal_Go_mutex.unlock(); 00022 00023 _Test_Go_mutex.lock(); 00024 _Test_Go =0; 00025 _Test_Go_mutex.unlock(); 00026 00027 _Select_mutex.lock(); 00028 _Select =0; 00029 _Select_mutex.unlock(); 00030 00031 _Turns_Done_mutex.lock(); 00032 _Turns_Done =0; 00033 _Turns_Done_mutex.unlock(); 00034 00035 _Loop_mutex.lock(); 00036 _Loop =6; 00037 _Loop_mutex.unlock(); 00038 00039 _Loops_done_mutex.lock(); 00040 _Loops_done = 0; 00041 _Loops_done_mutex.unlock(); 00042 00043 _On_Time_mutex.lock(); 00044 _On_Time =4; 00045 _On_Time_mutex.unlock(); 00046 00047 _Off_Time_mutex.lock(); 00048 _Off_Time =9; 00049 _Off_Time_mutex.unlock(); 00050 00051 _Duty_Cycle_mutex.lock(); 00052 _Duty_Cycle =0; 00053 _Duty_Cycle_mutex.unlock(); 00054 00055 _Power_Time_mutex.lock(); 00056 _Power_Time =0; 00057 _Power_Time_mutex.unlock(); 00058 00059 Led_Select_Left_mutex.lock(); 00060 Led_Select_Left = 0; 00061 Led_Select_Left_mutex.unlock(); 00062 00063 Led_Select_Right_mutex.lock(); 00064 Led_Select_Right= 0; 00065 Led_Select_Right_mutex.unlock(); 00066 00067 Led_Power_mutex.lock(); 00068 Led_Power =0; 00069 Led_Power_mutex.unlock(); 00070 00071 _System_Running_mutex.lock(); 00072 _System_Running =0; 00073 _System_Running_mutex.unlock(); 00074 00075 00076 Led_Select_Left_mutex.lock(); 00077 Led_Select_Left = 0; 00078 Led_Select_Left_mutex.unlock(); 00079 00080 Led_Select_Right_mutex.lock(); 00081 Led_Select_Right= 1; 00082 Led_Select_Right_mutex.unlock(); 00083 00084 _Turns_Todo_mutex.lock(); 00085 _Turns_Todo = turns; 00086 _Turns_Todo_mutex.unlock(); 00087 00088 00089 _Function_mutex.lock(); 00090 _Function = 0; 00091 _Function_mutex.unlock(); 00092 } 00093 00094 void INTERFACE::Interface_Serial() 00095 { 00096 printf("Testing\n"); 00097 Thread::wait(1000); 00098 } 00099 void INTERFACE::Up()//Up Routine 00100 { 00101 if (_Function == 2)//Coiling 00102 { 00103 if(_Select == 0) 00104 { 00105 _Turns_Todo_mutex.lock(); 00106 _Turns_Todo = _Turns_Todo +1; 00107 _Turns_Todo_mutex.unlock(); 00108 } 00109 else if(_Select == 1) 00110 { 00111 _Direction = !_Direction; 00112 } 00113 } 00114 else if (_Function == 3)//Run Once 00115 { 00116 if(_On_Time > 0) 00117 { 00118 _On_Time_mutex.lock(); 00119 _On_Time = _On_Time+ 0.5f; //Increments On time 00120 _On_Time_mutex.unlock(); 00121 } 00122 } 00123 else if (_Function == 0)//Annealing Function 00124 { 00125 if (_Select == 0)//Select = 0 00126 { 00127 if(_On_Time > 0) 00128 { 00129 _On_Time_mutex.lock(); 00130 _On_Time = _On_Time+ 0.5f; //Increments On time 00131 _On_Time_mutex.unlock(); 00132 } 00133 } 00134 else if (_Select == 1)//Select = 1 00135 { 00136 if(_Loop > 0) 00137 { 00138 _Loop_mutex.lock(); 00139 _Loop = _Loop + 1; //Increments Repetitions in Annealing 00140 _Loop_mutex.unlock(); 00141 } 00142 } 00143 else if (_Select == 2)//Select = 2 00144 { 00145 if(_Off_Time > 0) 00146 { 00147 _Off_Time_mutex.lock(); 00148 _Off_Time = _Off_Time + 1; //Increments Off time 00149 _Off_Time_mutex.unlock(); 00150 } 00151 } 00152 } 00153 else if (_Function == 1)//Test Function 00154 { 00155 if (_Select == 1)//Select = 1 00156 { 00157 if (_Duty_Cycle < 100) 00158 { 00159 _Duty_Cycle_mutex.lock(); 00160 _Duty_Cycle = _Duty_Cycle + 10; //Increases Testing Duty Cycle 00161 _Duty_Cycle_mutex.unlock(); 00162 } 00163 } 00164 else if (_Select == 0)//Select = 0 00165 { 00166 _Power_Time_mutex.lock(); 00167 _Power_Time = _Power_Time + 1; //Increases time on 00168 _Power_Time_mutex.unlock(); 00169 } 00170 } 00171 } 00172 00173 void INTERFACE::Down()//Down Routine 00174 { 00175 if(_Function == 3)//Run Once 00176 { 00177 if(_On_Time > 0) 00178 { 00179 _On_Time_mutex.lock(); 00180 _On_Time = _On_Time - 0.5f; //Decrements On time 00181 _On_Time_mutex.unlock(); 00182 } 00183 } 00184 else if (_Function == 2)//Coiling 00185 { 00186 if(_Select == 0) 00187 { 00188 _Turns_Todo_mutex.lock(); 00189 _Turns_Todo = _Turns_Todo -1; 00190 _Turns_Todo_mutex.unlock(); 00191 } 00192 else if(_Select == 1) 00193 { 00194 _Direction = !_Direction; 00195 } 00196 } 00197 else if (_Function == 0)//Annealing Function 00198 { 00199 if (_Select == 0)//Select = 0 00200 { 00201 if(_On_Time > 0) 00202 { 00203 _On_Time_mutex.lock(); 00204 _On_Time = _On_Time - 0.5f; //Decrements On time 00205 _On_Time_mutex.unlock(); 00206 } 00207 } 00208 else if (_Select == 1)//Select = 1 00209 { 00210 if(_Loop > 1) 00211 { 00212 _Loop_mutex.lock(); 00213 _Loop = _Loop - 1; //Decrements Repetitions in Annealing 00214 _Loop_mutex.unlock(); 00215 } 00216 } 00217 else if (_Select == 2)//Select = 2 00218 { 00219 if(_Off_Time > 1) 00220 { 00221 _Off_Time_mutex.lock(); 00222 _Off_Time = _Off_Time - 1; //Decrements Off time 00223 _Off_Time_mutex.unlock(); 00224 } 00225 } 00226 } 00227 else if (_Function == 1)//Test Function 00228 { 00229 if (_Select == 1)//Select = 1 00230 { 00231 if (_Duty_Cycle > 0) 00232 { 00233 _Duty_Cycle_mutex.lock(); 00234 _Duty_Cycle = _Duty_Cycle - 10; //Decreases duty 00235 _Duty_Cycle_mutex.unlock(); 00236 } 00237 } 00238 else if (_Select == 0)//Select = 0 00239 { 00240 if (_Power_Time > 0) 00241 { 00242 _Power_Time_mutex.lock(); 00243 _Power_Time = _Power_Time - 1; //Decreases Time on 00244 _Power_Time_mutex.unlock(); 00245 } 00246 } 00247 } 00248 } 00249 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00250 void INTERFACE::Start_Stop()//Start / Stop Routine 00251 { 00252 /* 00253 System Running = 0 Stop 00254 System Running = 1 Running 00255 System Running = 2 Paused 00256 */ 00257 00258 printf("Function is: %d, System is: %d\n",_Function,_System_Running);//Used for debugging 00259 00260 //Start Cases for when the system is stopped/////////////////////////////////////////////////////////////////////////////////// 00261 if((_Function == 3) & _System_Running == 0)//Run Once selected 00262 { 00263 _System_Running_mutex.lock(); 00264 _System_Running = 1;//Code is running 00265 _System_Running_mutex.unlock(); 00266 00267 _Run_Go_mutex.lock(); 00268 _Run_Go = true;//Run the run once code 00269 _Run_Go_mutex.unlock(); 00270 } 00271 00272 else if ((_Function == 2) & _System_Running == 0)//Coiling selected 00273 { 00274 _System_Running_mutex.lock(); 00275 _System_Running = 1;//Code is running 00276 _System_Running_mutex.unlock(); 00277 00278 _Twist_Go_mutex.lock(); 00279 _Twist_Go = true;//toggle used for coiling and twisting and Running the code 00280 _Twist_Go_mutex.unlock(); 00281 00282 } 00283 else if (_Function == 0 & _System_Running == 0) //Annealing selected 00284 { 00285 _System_Running_mutex.lock(); 00286 _System_Running = 1;//Code is running 00287 _System_Running_mutex.unlock(); 00288 00289 _Anneal_Go_mutex.lock(); 00290 _Anneal_Go = true;//toggle and Run the code 00291 _Anneal_Go_mutex.unlock(); 00292 00293 _Loops_done_mutex.lock(); 00294 _Loops_done = 0; 00295 _Loops_done_mutex.unlock(); 00296 } 00297 else if (_Function == 1 & _System_Running == 0) //Testing selected 00298 { 00299 _System_Running_mutex.lock(); 00300 _System_Running = 1;//Code is running 00301 _System_Running_mutex.unlock(); 00302 00303 _Test_Go_mutex.lock(); 00304 _Test_Go = true;//toggle and run the code 00305 _Test_Go_mutex.unlock(); 00306 } 00307 /////////////////////////////////////// 00308 00309 //System Running cases run to pause the code 00310 else if((_Function == 3) & _System_Running == 1)//Run once code 00311 { 00312 _Run_Stop_mutex.lock(); 00313 _Run_Stop = true; 00314 _Run_Stop_mutex.unlock(); 00315 _System_Running_mutex.lock(); 00316 _System_Running = 2; 00317 _System_Running_mutex.unlock(); 00318 } 00319 else if ((_Function == 2) & _System_Running == 1)//Coiling 00320 { 00321 _Twist_Stop_mutex.lock(); 00322 _Twist_Stop = true; 00323 _Twist_Stop_mutex.unlock(); 00324 00325 printf("Coiling Code Paused\n"); 00326 _System_Running_mutex.lock(); 00327 _System_Running = 2; 00328 _System_Running_mutex.unlock(); 00329 STEPPER_MOTOR_1.Pause_Code(); 00330 } 00331 else if (_Function == 0 & _System_Running == 1) //Annealing selected to be stopped 00332 { 00333 _Anneal_Stop_mutex.lock(); 00334 _Anneal_Stop = true; 00335 _Anneal_Stop_mutex.unlock(); 00336 printf("Annealing Code Paused\n"); 00337 _System_Running_mutex.lock(); 00338 _System_Running = 2;//Pause code 00339 _System_Running_mutex.unlock(); 00340 } 00341 else if (_Function == 1 & _System_Running == 1) //Testing selected to be paused 00342 { 00343 _Test_Stop_mutex.lock(); 00344 _Test_Stop = true; 00345 _Test_Stop_mutex.unlock(); 00346 00347 printf("Testing Code Paused\n"); 00348 00349 00350 00351 _System_Running_mutex.lock(); 00352 _System_Running = 2;//Pause code 00353 _System_Running_mutex.unlock(); 00354 } 00355 00356 //////////////// 00357 //System Paused cases run to unpause 00358 else if ((_Function == 3) & _System_Running ==2) 00359 { 00360 _Run_Stop_mutex.lock(); 00361 _Run_Stop = false; 00362 _Run_Stop_mutex.unlock(); 00363 00364 _Run_Go_mutex.lock(); 00365 _Run_Go = true;//toggle used for coiling and twisting and Running the code 00366 _Run_Go_mutex.unlock(); 00367 00368 00369 _System_Running_mutex.lock(); 00370 _System_Running = 1;//Code is unpaused 00371 _System_Running_mutex.unlock(); 00372 00373 } 00374 else if ((_Function == 2) & _System_Running == 2)//Coil to be unpaused 00375 { 00376 _Twist_Stop_mutex.lock(); 00377 _Twist_Stop = false; 00378 _Twist_Stop_mutex.unlock(); 00379 00380 _Twist_Go_mutex.lock(); 00381 _Twist_Go = true;//toggle used for coiling and twisting and Running the code 00382 _Twist_Go_mutex.unlock(); 00383 00384 STEPPER_MOTOR_1.Unpause_Code(); 00385 00386 00387 printf("Coiling Code unpaused\n"); 00388 00389 _System_Running_mutex.lock(); 00390 _System_Running = 1;//Code is unpaused 00391 _System_Running_mutex.unlock(); 00392 } 00393 else if (_Function == 0 & _System_Running == 2) //Annealing selected to be unpaused 00394 { 00395 _Anneal_Stop_mutex.lock(); 00396 _Anneal_Stop = false; 00397 _Anneal_Stop_mutex.unlock(); 00398 printf("Annealing Code unpaused\n"); 00399 00400 _Anneal_Go_mutex.lock(); 00401 _Anneal_Go = true;//toggle and Run the code 00402 _Anneal_Go_mutex.unlock(); 00403 _System_Running_mutex.lock(); 00404 _System_Running = 1;//Code is unpaused 00405 _System_Running_mutex.unlock(); 00406 } 00407 else if (_Function == 1 & _System_Running == 2) //Testing selected to be re run 00408 { 00409 _Test_Stop_mutex.lock(); 00410 _Test_Stop = false; 00411 _Test_Stop_mutex.unlock(); 00412 printf("Testing Code unpaused\n"); 00413 _Test_Go_mutex.lock(); 00414 _Test_Go = true;//toggle and run the code 00415 _Test_Go_mutex.unlock(); 00416 _System_Running_mutex.lock(); 00417 _System_Running = 1;//Code is unpaused 00418 _System_Running_mutex.unlock(); 00419 } 00420 } 00421 void INTERFACE::Function()//Function Routine used to increment through the three functions 00422 { 00423 /* 00424 Function 0 = Anneal 00425 Function 1 = Test 00426 Function 2 = Coiling 00427 Function 3 = Run Once 00428 */ 00429 _Select_mutex.lock(); 00430 _Select = 0;//Set the select value to 0 whenever the function is changed 00431 _Select_mutex.unlock(); 00432 00433 if(_Function < 3) 00434 { 00435 _Function_mutex.lock(); 00436 _Function = _Function + 1; 00437 _Function_mutex.unlock(); 00438 } 00439 else if(_Function == 3) 00440 { 00441 _Function = 0; 00442 } 00443 } 00444 void INTERFACE::Select()//Select Routine 00445 { 00446 _Select_mutex.lock(); 00447 if(_Function == 0)//Anneal 00448 { 00449 printf("Select Value is :%d\n",_Select); 00450 if(_Select == 2) 00451 { 00452 _Select = 0; 00453 } 00454 else if(_Select == 1) 00455 { 00456 _Select = 2; 00457 } 00458 else if(_Select == 0) 00459 { 00460 _Select = 1; 00461 } 00462 if(_Select == 0 || _Select == 2) 00463 { 00464 Led_Select_Left_mutex.lock(); 00465 Led_Select_Left = 0; 00466 Led_Select_Left_mutex.unlock(); 00467 00468 Led_Select_Right_mutex.lock(); 00469 Led_Select_Right= 1; 00470 Led_Select_Right_mutex.unlock(); 00471 } 00472 else if(_Select == 1) 00473 { 00474 Led_Select_Left_mutex.lock(); 00475 Led_Select_Left = 1; 00476 Led_Select_Left_mutex.unlock(); 00477 00478 Led_Select_Right_mutex.lock(); 00479 Led_Select_Right= 0; 00480 Led_Select_Right_mutex.unlock(); 00481 } 00482 printf("Select Value is :%d\n",_Select); 00483 } 00484 else if(_Function == 1)//Test 00485 { 00486 if(_Select == 0) 00487 { 00488 _Select = 1; 00489 } 00490 else if(_Select == 1) 00491 { 00492 _Select = 0; 00493 } 00494 00495 if(_Select == 0) 00496 { 00497 Led_Select_Left_mutex.lock(); 00498 Led_Select_Left = 0; 00499 Led_Select_Left_mutex.unlock(); 00500 00501 Led_Select_Right_mutex.lock(); 00502 Led_Select_Right= 1; 00503 Led_Select_Right_mutex.unlock(); 00504 } 00505 else if(_Select ==1) 00506 { 00507 Led_Select_Left_mutex.lock(); 00508 Led_Select_Left = 1; 00509 Led_Select_Left_mutex.unlock(); 00510 00511 Led_Select_Right_mutex.lock(); 00512 Led_Select_Right= 0; 00513 Led_Select_Right_mutex.unlock(); 00514 } 00515 } 00516 else if(_Function == 2 )//Coiling 00517 { 00518 if(_Select == 0)//Toggle code for select 00519 { 00520 _Select = 1; 00521 } 00522 else if(_Select == 1) 00523 { 00524 _Select = 0; 00525 } 00526 00527 if(_Select == 0) 00528 { 00529 Led_Select_Left_mutex.lock(); 00530 Led_Select_Left = 0; 00531 Led_Select_Left_mutex.unlock(); 00532 00533 Led_Select_Right_mutex.lock(); 00534 Led_Select_Right= 1; 00535 Led_Select_Right_mutex.unlock(); 00536 } 00537 else if(_Select == 1) 00538 { 00539 Led_Select_Left_mutex.lock(); 00540 Led_Select_Left = 1; 00541 Led_Select_Left_mutex.unlock(); 00542 00543 Led_Select_Right_mutex.lock(); 00544 Led_Select_Right= 0; 00545 Led_Select_Right_mutex.unlock(); 00546 } 00547 } 00548 else if(_Function == 3)//Run once code alway have the led to be on the left 00549 { 00550 Led_Select_Left_mutex.lock(); 00551 Led_Select_Left = 0; 00552 Led_Select_Left_mutex.unlock(); 00553 00554 Led_Select_Right_mutex.lock(); 00555 Led_Select_Right= 1; 00556 Led_Select_Right_mutex.unlock(); 00557 } 00558 _Select_mutex.unlock(); 00559 } 00560 void INTERFACE::Interface_main()//Main Routine to execute commands when the start button has been pressed 00561 { 00562 if (_Function == 3) //Run once code Code 00563 { 00564 if (_Run_Go == true) 00565 { 00566 Led_Power_mutex.lock(); 00567 Led_Power = 1; 00568 Led_Power_mutex.unlock(); 00569 00570 _System_Running_mutex.lock(); 00571 _System_Running = 1; 00572 _System_Running_mutex.unlock(); 00573 00574 00575 if(_System_Running == 1) 00576 { 00577 00578 _Run_Once_On_Time_mutex.lock(); 00579 Thread::wait((_Run_Once_On_Time)*1000);//Variable 00580 _Run_Once_On_Time_mutex.unlock(); 00581 00582 Thread::wait(9001);//Fixed off time ITS OVER 9000 00583 _Tendon_mutex.unlock(); 00584 } 00585 while(_System_Running == 2)//Stops the system and just spins in this while loop until system running is not paused 00586 { 00587 _Tendon_mutex.lock(); 00588 00589 _Tendon_mutex.unlock(); 00590 } 00591 00592 _System_Running_mutex.lock(); 00593 _System_Running = 0; 00594 _System_Running_mutex.unlock(); 00595 00596 _Run_Go_mutex.lock(); 00597 _Run_Go = false; 00598 _Run_Go_mutex.unlock(); 00599 00600 Led_Power_mutex.lock(); 00601 Led_Power = 0; 00602 Led_Power_mutex.unlock(); 00603 } 00604 } 00605 else if (_Function == 2) //Turning Code for coiling 00606 { 00607 if (_Twist_Go == true) 00608 { 00609 Led_Power_mutex.lock(); 00610 Led_Power = 1; 00611 Led_Power_mutex.unlock(); 00612 00613 _System_Running_mutex.lock(); 00614 _System_Running = 1; 00615 _System_Running_mutex.unlock(); 00616 00617 STEPPER_MOTOR_1.Rotate_Steps(_Turns_Todo,_Function,_Direction);//Rotates for the specified number of steps given 00618 00619 _System_Running_mutex.lock(); 00620 _System_Running = 0; 00621 _System_Running_mutex.unlock(); 00622 00623 00624 _Twist_Go_mutex.lock(); 00625 _Twist_Go = false; 00626 _Twist_Go_mutex.unlock(); 00627 00628 Led_Power_mutex.lock(); 00629 Led_Power = 0; 00630 Led_Power_mutex.unlock(); 00631 } 00632 } 00633 else if (_Function == 0) //Annealing Code 00634 { 00635 if (_Anneal_Go == true) 00636 { 00637 Led_Power_mutex.lock(); 00638 Led_Power = 1; 00639 Led_Power_mutex.unlock(); 00640 00641 _System_Running_mutex.lock(); 00642 _System_Running = 1; 00643 _System_Running_mutex.unlock(); 00644 00645 _Loops_done_mutex.lock(); 00646 _Loops_done = 0; 00647 _Loops_done_mutex.unlock(); 00648 00649 for ( int counter = 0; counter < _Loop; counter++) //Loop value, check if works 00650 { 00651 if(_System_Running == 1) 00652 { 00653 _Tendon_mutex.lock(); 00654 00655 _On_Time_mutex.lock(); 00656 Thread::wait((_On_Time)*1000);//Variable 00657 _On_Time_mutex.unlock(); 00658 00659 _Off_Time_mutex.lock(); 00660 Thread::wait((_Off_Time)*1000);//Fixed off time 00661 _Off_Time_mutex.unlock(); 00662 _Tendon_mutex.unlock(); 00663 } 00664 while(_System_Running == 2)//Stops the system and just spins in this while loop until system running is not paused 00665 { 00666 00667 } 00668 _Loops_done_mutex.lock(); 00669 _Loops_done = _Loops_done + 1; 00670 _Loops_done_mutex.unlock(); 00671 } 00672 00673 _System_Running_mutex.lock(); 00674 _System_Running = 0; 00675 _System_Running_mutex.unlock(); 00676 00677 _Anneal_Go_mutex.lock(); 00678 _Anneal_Go = false; 00679 _Anneal_Go_mutex.unlock(); 00680 00681 Led_Power_mutex.lock(); 00682 Led_Power = 0; 00683 Led_Power_mutex.unlock(); 00684 } 00685 } 00686 else if (_Function == 1) //Testing Code //This code is paused / unpaused in start / stop note this code is not paused it is re run. 00687 { 00688 if (_Test_Go == true) 00689 { 00690 Led_Power_mutex.lock(); 00691 Led_Power = 1; 00692 Led_Power_mutex.unlock(); 00693 00694 _System_Running_mutex.lock(); 00695 _System_Running = 1; 00696 _System_Running_mutex.unlock(); 00697 00698 _Tendon_mutex.lock(); 00699 Thread::wait((_Power_Time)*1000);//Variable on time for power on 00700 00701 _Tendon_mutex.unlock(); 00702 00703 _System_Running_mutex.lock(); 00704 _System_Running = 0; 00705 _System_Running_mutex.unlock(); 00706 00707 _Test_Go_mutex.lock(); 00708 _Test_Go = false; 00709 _Test_Go_mutex.unlock(); 00710 00711 Led_Power_mutex.lock(); 00712 Led_Power = 0; 00713 Led_Power_mutex.unlock(); 00714 } 00715 } 00716 } 00717 //Setter functions 00718 void INTERFACE::Set_System_Running(int System_Running){_System_Running_mutex.lock(); _System_Running = System_Running; _System_Running_mutex.unlock();} 00719 void INTERFACE::Set_Function(int Function){_Function_mutex.lock();_Function = Function;_Function_mutex.unlock();} 00720 void INTERFACE::Set_Twist_Go(bool Twist_Go){_Twist_Go_mutex.lock();_Twist_Go = Twist_Go;_Twist_Go_mutex.unlock();} 00721 void INTERFACE::Set_Anneal_Go(bool Anneal_Go){_Anneal_Go_mutex.lock();_Anneal_Go = Anneal_Go;_Anneal_Go_mutex.unlock();} 00722 void INTERFACE::Set_Test_Go(bool Test_Go){_Test_Go_mutex.lock();_Test_Go = Test_Go;_Test_Go_mutex.unlock();} 00723 void INTERFACE::Set_Run_Go(bool Run_Go){_Run_Go_mutex.lock();_Run_Go = Run_Go;_Run_Go_mutex.unlock();} 00724 void INTERFACE::Set_Twist_Stop(bool Twist_Stop){_Twist_Stop_mutex.lock();_Twist_Stop = Twist_Stop;_Twist_Stop_mutex.unlock();} 00725 void INTERFACE::Set_Anneal_Stop(bool Anneal_Stop){_Anneal_Stop_mutex.lock();_Anneal_Stop = Anneal_Stop;_Anneal_Stop_mutex.unlock();} 00726 void INTERFACE::Set_Test_Stop(bool Test_Stop){_Test_Stop_mutex.lock();_Test_Go = Test_Stop;_Test_Stop_mutex.unlock();} 00727 void INTERFACE::Set_Run_Stop(bool Run_Stop){_Run_Stop_mutex.lock();_Run_Stop = Run_Stop;_Run_Stop_mutex.unlock();} 00728 void INTERFACE::Set_Select(int Select){_Select_mutex.lock();_Select = Select;_Select_mutex.unlock();} 00729 void INTERFACE::Set_Turns_Done(int Turns_Done){_Turns_Done_mutex.lock();_Turns_Done = Turns_Done;_Turns_Done_mutex.unlock();} 00730 void INTERFACE::Set_Turns_To_Do(int Turns_Todo){_Turns_Todo_mutex.lock();_Turns_Todo = Turns_Todo;_Turns_Todo_mutex.unlock();} 00731 void INTERFACE::Set_Loop(int Loop){_Loop_mutex.lock();Loop = Loop;_Loop_mutex.unlock();} 00732 void INTERFACE::Set_Loops_done(int Loops_done){_Loops_done_mutex.lock();_Loops_done = Loops_done; _Loops_done_mutex.unlock();} 00733 void INTERFACE::Set_On_Time(float On_Time){_On_Time_mutex.lock();_On_Time = On_Time;_On_Time_mutex.unlock();} 00734 void INTERFACE::Set_Run_Once_On_Time(float Run_Once_On_Time){_Run_Once_On_Time_mutex.lock();_Run_Once_On_Time = Run_Once_On_Time;_Run_Once_On_Time_mutex.unlock();} 00735 void INTERFACE::Set_Off_Time(int Off_Time){_Off_Time_mutex.lock();_Off_Time = Off_Time;_Off_Time_mutex.unlock();} 00736 void INTERFACE::Set_Duty_Cycle(int Duty_Cycle){_Duty_Cycle_mutex.lock();_Duty_Cycle = Duty_Cycle;_Duty_Cycle_mutex.unlock();} 00737 void INTERFACE::Set_Power_Time(float Power_Time){_Power_Time_mutex.lock();_Power_Time = Power_Time;_Power_Time_mutex.unlock();} 00738 void INTERFACE::Set_Direction(bool Direction){_Direction_mutex.lock();_Direction = Direction;_Direction_mutex.unlock();} 00739 //Getter functions 00740 int INTERFACE::Get_System_Running(){return _System_Running;} 00741 int INTERFACE::Get_Function(){return _Function;} 00742 bool INTERFACE::Get_Twist_Go(){return _Twist_Go;} 00743 bool INTERFACE::Get_Anneal_Go(){return _Anneal_Go;} 00744 bool INTERFACE::Get_Test_Go(){return _Test_Go;} 00745 bool INTERFACE::Get_Run_Go(){return _Run_Go;} 00746 bool INTERFACE::Get_Twist_Stop(){return _Twist_Stop;} 00747 bool INTERFACE::Get_Anneal_Stop(){return _Anneal_Stop;} 00748 bool INTERFACE::Get_Test_Stop(){return _Test_Stop;} 00749 bool INTERFACE::Get_Run_Stop(){return _Run_Stop;} 00750 int INTERFACE::Get_Select(){return _Select;} 00751 int INTERFACE::Get_Turns_Done(){_Turns_Done = STEPPER_MOTOR_1.Get_Turns(); return _Turns_Done;} 00752 int INTERFACE::Get_Turns_To_Do(){return _Turns_Todo;} 00753 int INTERFACE::Get_Loops_done(){return _Loops_done;} 00754 int INTERFACE::Get_Loop(){return _Loop;} 00755 float INTERFACE::Get_On_Time(){return _On_Time;} 00756 float INTERFACE::Get_Run_Once_On_Time(){return _Run_Once_On_Time;} 00757 int INTERFACE::Get_Off_Time(){return _Off_Time;} 00758 int INTERFACE::Get_Duty_Cycle(){return _Duty_Cycle;} 00759 int INTERFACE::Get_Power_Time(){return _Power_Time;} 00760 bool INTERFACE::Get_Direction(){return _Direction;}
Generated on Tue Jul 12 2022 21:12:35 by
1.7.2