Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Wed Mar 13 11:34:39 2019 +0000
Revision:
29:f3b1387c81f1
Parent:
28:3193157ebb0c
Child:
30:a35f0ab97a65
Final Coiling Rig;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thomasmorris 23:07a368f2cdb1 1 #include "Interface.hpp" //Include the header file, this acts like a series of forward declarations
thomasmorris 16:9f98ec0ededb 2 //Constructor
thomasmorris 25:9751619fa030 3 INTERFACE::INTERFACE(){}//Set all values to 0
thomasmorris 16:9f98ec0ededb 4 INTERFACE::~INTERFACE(){} //Destructor
thomasmorris 29:f3b1387c81f1 5 void INTERFACE::Interface_Init(int turns, int type_of_rig)//Set all values to 0 bar the default turns
thomasmorris 16:9f98ec0ededb 6 {
thomasmorris 24:728de4bf961e 7 Led_Select_Left_mutex.lock();
thomasmorris 24:728de4bf961e 8 Led_Select_Left = 0;
thomasmorris 24:728de4bf961e 9 Led_Select_Left_mutex.unlock();
thomasmorris 24:728de4bf961e 10
thomasmorris 24:728de4bf961e 11 Led_Select_Right_mutex.lock();
thomasmorris 24:728de4bf961e 12 Led_Select_Right= 0;
thomasmorris 24:728de4bf961e 13 Led_Select_Right_mutex.unlock();
thomasmorris 24:728de4bf961e 14
thomasmorris 23:07a368f2cdb1 15 _Twist_Go_mutex.lock();
thomasmorris 17:68b3fdabe4c5 16 _Twist_Go =0;
thomasmorris 23:07a368f2cdb1 17 _Twist_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 18
thomasmorris 23:07a368f2cdb1 19 _Anneal_Go_mutex.lock();
thomasmorris 17:68b3fdabe4c5 20 _Anneal_Go =0;
thomasmorris 23:07a368f2cdb1 21 _Anneal_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 22
thomasmorris 23:07a368f2cdb1 23 _Test_Go_mutex.lock();
thomasmorris 17:68b3fdabe4c5 24 _Test_Go =0;
thomasmorris 23:07a368f2cdb1 25 _Test_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 26
thomasmorris 23:07a368f2cdb1 27 _Select_mutex.lock();
thomasmorris 17:68b3fdabe4c5 28 _Select =0;
thomasmorris 23:07a368f2cdb1 29 _Select_mutex.unlock();
thomasmorris 23:07a368f2cdb1 30
thomasmorris 23:07a368f2cdb1 31 _Turns_Done_mutex.lock();
thomasmorris 17:68b3fdabe4c5 32 _Turns_Done =0;
thomasmorris 23:07a368f2cdb1 33 _Turns_Done_mutex.unlock();
thomasmorris 23:07a368f2cdb1 34
thomasmorris 23:07a368f2cdb1 35 _Loop_mutex.lock();
thomasmorris 25:9751619fa030 36 _Loop =6;
thomasmorris 23:07a368f2cdb1 37 _Loop_mutex.unlock();
thomasmorris 23:07a368f2cdb1 38
thomasmorris 25:9751619fa030 39 _On_Time_mutex.lock();
thomasmorris 25:9751619fa030 40 _On_Time =6;
thomasmorris 25:9751619fa030 41 _On_Time_mutex.unlock();
thomasmorris 25:9751619fa030 42
thomasmorris 25:9751619fa030 43 _Off_Time_mutex.lock();
thomasmorris 25:9751619fa030 44 _Off_Time =6;
thomasmorris 25:9751619fa030 45 _Off_Time_mutex.unlock();
thomasmorris 23:07a368f2cdb1 46
thomasmorris 23:07a368f2cdb1 47 _Duty_Cycle_mutex.lock();
thomasmorris 17:68b3fdabe4c5 48 _Duty_Cycle =0;
thomasmorris 23:07a368f2cdb1 49 _Duty_Cycle_mutex.unlock();
thomasmorris 23:07a368f2cdb1 50
thomasmorris 23:07a368f2cdb1 51 _Power_Time_mutex.lock();
thomasmorris 17:68b3fdabe4c5 52 _Power_Time =0;
thomasmorris 23:07a368f2cdb1 53 _Power_Time_mutex.unlock();
thomasmorris 23:07a368f2cdb1 54
thomasmorris 23:07a368f2cdb1 55 Led_Select_Left_mutex.lock();
thomasmorris 23:07a368f2cdb1 56 Led_Select_Left = 0;
thomasmorris 23:07a368f2cdb1 57 Led_Select_Left_mutex.unlock();
thomasmorris 23:07a368f2cdb1 58
thomasmorris 23:07a368f2cdb1 59 Led_Select_Right_mutex.lock();
thomasmorris 23:07a368f2cdb1 60 Led_Select_Right= 0;
thomasmorris 23:07a368f2cdb1 61 Led_Select_Right_mutex.unlock();
thomasmorris 23:07a368f2cdb1 62
thomasmorris 23:07a368f2cdb1 63 Led_Power_mutex.lock();
thomasmorris 23:07a368f2cdb1 64 Led_Power =0;
thomasmorris 23:07a368f2cdb1 65 Led_Power_mutex.unlock();
thomasmorris 23:07a368f2cdb1 66
thomasmorris 23:07a368f2cdb1 67 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 68 _System_Running =0;
thomasmorris 23:07a368f2cdb1 69 _System_Running_mutex.unlock();
thomasmorris 24:728de4bf961e 70
thomasmorris 24:728de4bf961e 71
thomasmorris 26:83550fc299aa 72 Led_Select_Left_mutex.lock();
thomasmorris 26:83550fc299aa 73 Led_Select_Left = 0;
thomasmorris 26:83550fc299aa 74 Led_Select_Left_mutex.unlock();
thomasmorris 24:728de4bf961e 75
thomasmorris 26:83550fc299aa 76 Led_Select_Right_mutex.lock();
thomasmorris 26:83550fc299aa 77 Led_Select_Right= 1;
thomasmorris 26:83550fc299aa 78 Led_Select_Right_mutex.unlock();
thomasmorris 26:83550fc299aa 79
thomasmorris 26:83550fc299aa 80 _Turns_Todo_mutex.lock();
thomasmorris 29:f3b1387c81f1 81 _Turns_Todo = turns;
thomasmorris 29:f3b1387c81f1 82 _Turns_Todo_mutex.unlock();
thomasmorris 29:f3b1387c81f1 83
thomasmorris 29:f3b1387c81f1 84 _Type_of_Rig_mutex.lock();
thomasmorris 29:f3b1387c81f1 85 _Type_of_Rig = type_of_rig;
thomasmorris 29:f3b1387c81f1 86 _Type_of_Rig_mutex.unlock();
thomasmorris 29:f3b1387c81f1 87
thomasmorris 29:f3b1387c81f1 88 _Function_mutex.lock();
thomasmorris 29:f3b1387c81f1 89 _Function = type_of_rig;
thomasmorris 29:f3b1387c81f1 90 _Function_mutex.unlock();
thomasmorris 16:9f98ec0ededb 91 }
thomasmorris 17:68b3fdabe4c5 92 void INTERFACE::Up()//Up Routine
thomasmorris 16:9f98ec0ededb 93 {
thomasmorris 25:9751619fa030 94 if (_Function == 2 || _Function == 3 )//Coiling or twist Function
thomasmorris 16:9f98ec0ededb 95 {
thomasmorris 29:f3b1387c81f1 96 if(_Select == 0)
thomasmorris 29:f3b1387c81f1 97 {
thomasmorris 29:f3b1387c81f1 98 _Turns_Todo_mutex.lock();
thomasmorris 29:f3b1387c81f1 99 _Turns_Todo = _Turns_Todo +1;
thomasmorris 29:f3b1387c81f1 100 _Turns_Todo_mutex.unlock();
thomasmorris 29:f3b1387c81f1 101 }
thomasmorris 29:f3b1387c81f1 102 else if(_Select == 1)
thomasmorris 29:f3b1387c81f1 103 {
thomasmorris 29:f3b1387c81f1 104 _Direction = !_Direction;
thomasmorris 29:f3b1387c81f1 105 }
thomasmorris 16:9f98ec0ededb 106 }
thomasmorris 25:9751619fa030 107 else if (_Function == 0)//Annealing Function
thomasmorris 16:9f98ec0ededb 108 {
thomasmorris 25:9751619fa030 109 if (_Select == 0)//Select = 0
thomasmorris 23:07a368f2cdb1 110 {
thomasmorris 26:83550fc299aa 111 if(_On_Time > 0)
thomasmorris 26:83550fc299aa 112 {
thomasmorris 26:83550fc299aa 113 _On_Time_mutex.lock();
thomasmorris 26:83550fc299aa 114 _On_Time = _On_Time+ 1; //Increments On time
thomasmorris 26:83550fc299aa 115 _On_Time_mutex.unlock();
thomasmorris 26:83550fc299aa 116 }
thomasmorris 16:9f98ec0ededb 117 }
thomasmorris 25:9751619fa030 118 else if (_Select == 1)//Select = 1
thomasmorris 16:9f98ec0ededb 119 {
thomasmorris 26:83550fc299aa 120 if(_Loop > 0)
thomasmorris 26:83550fc299aa 121 {
thomasmorris 26:83550fc299aa 122 _Loop_mutex.lock();
thomasmorris 26:83550fc299aa 123 _Loop = _Loop + 1; //Increments Repetitions in Annealing
thomasmorris 26:83550fc299aa 124 _Loop_mutex.unlock();
thomasmorris 26:83550fc299aa 125 }
thomasmorris 25:9751619fa030 126 }
thomasmorris 26:83550fc299aa 127 else if (_Select == 2)//Select = 2
thomasmorris 25:9751619fa030 128 {
thomasmorris 26:83550fc299aa 129 if(_Off_Time > 0)
thomasmorris 26:83550fc299aa 130 {
thomasmorris 26:83550fc299aa 131 _Off_Time_mutex.lock();
thomasmorris 26:83550fc299aa 132 _Off_Time = _Off_Time + 1; //Increments Off time
thomasmorris 26:83550fc299aa 133 _Off_Time_mutex.unlock();
thomasmorris 26:83550fc299aa 134 }
thomasmorris 16:9f98ec0ededb 135 }
thomasmorris 16:9f98ec0ededb 136 }
thomasmorris 25:9751619fa030 137 else if (_Function == 1)//Test Function
thomasmorris 16:9f98ec0ededb 138 {
thomasmorris 26:83550fc299aa 139 if (_Select == 1)//Select = 1
thomasmorris 16:9f98ec0ededb 140 {
thomasmorris 16:9f98ec0ededb 141 if (_Duty_Cycle < 100)
thomasmorris 16:9f98ec0ededb 142 {
thomasmorris 23:07a368f2cdb1 143 _Duty_Cycle_mutex.lock();
thomasmorris 16:9f98ec0ededb 144 _Duty_Cycle = _Duty_Cycle + 10; //Increases Testing Duty Cycle
thomasmorris 23:07a368f2cdb1 145 _Duty_Cycle_mutex.unlock();
thomasmorris 16:9f98ec0ededb 146 }
thomasmorris 24:728de4bf961e 147 }
thomasmorris 26:83550fc299aa 148 else if (_Select == 0)//Select = 0
thomasmorris 24:728de4bf961e 149 {
thomasmorris 24:728de4bf961e 150 _Power_Time_mutex.lock();
thomasmorris 24:728de4bf961e 151 _Power_Time = _Power_Time + 1; //Increases time on
thomasmorris 24:728de4bf961e 152 _Power_Time_mutex.unlock();
thomasmorris 16:9f98ec0ededb 153 }
thomasmorris 16:9f98ec0ededb 154 }
thomasmorris 16:9f98ec0ededb 155 }
thomasmorris 29:f3b1387c81f1 156
thomasmorris 17:68b3fdabe4c5 157 void INTERFACE::Down()//Down Routine
thomasmorris 16:9f98ec0ededb 158 {
thomasmorris 29:f3b1387c81f1 159 if (_Function == 2 || _Function == 3)//Coiling or twist Function
thomasmorris 29:f3b1387c81f1 160 {
thomasmorris 29:f3b1387c81f1 161 if(_Select == 0)
thomasmorris 16:9f98ec0ededb 162 {
thomasmorris 29:f3b1387c81f1 163 _Turns_Todo_mutex.lock();
thomasmorris 29:f3b1387c81f1 164 _Turns_Todo = _Turns_Todo -1;
thomasmorris 29:f3b1387c81f1 165 _Turns_Todo_mutex.unlock();
thomasmorris 16:9f98ec0ededb 166 }
thomasmorris 29:f3b1387c81f1 167 else if(_Select == 1)
thomasmorris 26:83550fc299aa 168 {
thomasmorris 29:f3b1387c81f1 169 _Direction = !_Direction;
thomasmorris 26:83550fc299aa 170 }
thomasmorris 25:9751619fa030 171 }
thomasmorris 29:f3b1387c81f1 172 else if (_Function == 0)//Annealing Function
thomasmorris 25:9751619fa030 173 {
thomasmorris 29:f3b1387c81f1 174 if (_Select == 0)//Select = 0
thomasmorris 29:f3b1387c81f1 175 {
thomasmorris 29:f3b1387c81f1 176 if(_On_Time > 1)
thomasmorris 29:f3b1387c81f1 177 {
thomasmorris 29:f3b1387c81f1 178 _On_Time_mutex.lock();
thomasmorris 29:f3b1387c81f1 179 _On_Time = _On_Time - 1; //Decrements On time
thomasmorris 29:f3b1387c81f1 180 _On_Time_mutex.unlock();
thomasmorris 29:f3b1387c81f1 181 }
thomasmorris 29:f3b1387c81f1 182 }
thomasmorris 29:f3b1387c81f1 183 else if (_Select == 1)//Select = 1
thomasmorris 26:83550fc299aa 184 {
thomasmorris 29:f3b1387c81f1 185 if(_Loop > 1)
thomasmorris 29:f3b1387c81f1 186 {
thomasmorris 29:f3b1387c81f1 187 _Loop_mutex.lock();
thomasmorris 29:f3b1387c81f1 188 _Loop = _Loop - 1; //Decrements Repetitions in Annealing
thomasmorris 29:f3b1387c81f1 189 _Loop_mutex.unlock();
thomasmorris 29:f3b1387c81f1 190 }
thomasmorris 29:f3b1387c81f1 191 }
thomasmorris 29:f3b1387c81f1 192 else if (_Select == 2)//Select = 2
thomasmorris 29:f3b1387c81f1 193 {
thomasmorris 29:f3b1387c81f1 194 if(_Off_Time > 1)
thomasmorris 29:f3b1387c81f1 195 {
thomasmorris 29:f3b1387c81f1 196 _Off_Time_mutex.lock();
thomasmorris 29:f3b1387c81f1 197 _Off_Time = _Off_Time - 1; //Decrements Off time
thomasmorris 29:f3b1387c81f1 198 _Off_Time_mutex.unlock();
thomasmorris 29:f3b1387c81f1 199 }
thomasmorris 26:83550fc299aa 200 }
thomasmorris 16:9f98ec0ededb 201 }
thomasmorris 29:f3b1387c81f1 202 else if (_Function == 1)//Test Function
thomasmorris 29:f3b1387c81f1 203 {
thomasmorris 29:f3b1387c81f1 204 if (_Select == 1)//Select = 1
thomasmorris 16:9f98ec0ededb 205 {
thomasmorris 29:f3b1387c81f1 206 if (_Duty_Cycle > 0)
thomasmorris 29:f3b1387c81f1 207 {
thomasmorris 29:f3b1387c81f1 208 _Duty_Cycle_mutex.lock();
thomasmorris 29:f3b1387c81f1 209 _Duty_Cycle = _Duty_Cycle - 10; //Decreases duty
thomasmorris 29:f3b1387c81f1 210 _Duty_Cycle_mutex.unlock();
thomasmorris 29:f3b1387c81f1 211 }
thomasmorris 29:f3b1387c81f1 212 }
thomasmorris 29:f3b1387c81f1 213 else if (_Select == 0)//Select = 0
thomasmorris 29:f3b1387c81f1 214 {
thomasmorris 29:f3b1387c81f1 215 if (_Power_Time > 0)
thomasmorris 29:f3b1387c81f1 216 {
thomasmorris 29:f3b1387c81f1 217 _Power_Time_mutex.lock();
thomasmorris 29:f3b1387c81f1 218 _Power_Time = _Power_Time - 1; //Decreases Time on
thomasmorris 29:f3b1387c81f1 219 _Power_Time_mutex.unlock();
thomasmorris 29:f3b1387c81f1 220 }
thomasmorris 16:9f98ec0ededb 221 }
thomasmorris 24:728de4bf961e 222 }
thomasmorris 16:9f98ec0ededb 223 }
thomasmorris 28:3193157ebb0c 224 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
thomasmorris 17:68b3fdabe4c5 225 void INTERFACE::Start_Stop()//Start / Stop Routine
thomasmorris 16:9f98ec0ededb 226 {
thomasmorris 28:3193157ebb0c 227 /*
thomasmorris 28:3193157ebb0c 228 System Running = 0 Stop
thomasmorris 28:3193157ebb0c 229 System Running = 1 Running
thomasmorris 28:3193157ebb0c 230 System Running = 2 Paused
thomasmorris 28:3193157ebb0c 231 */
thomasmorris 24:728de4bf961e 232
thomasmorris 28:3193157ebb0c 233 printf("Function is: %d, System is: %d\n",_Function,_System_Running);//Used for debugging
thomasmorris 28:3193157ebb0c 234
thomasmorris 28:3193157ebb0c 235 //Start Cases for when the system is stopped///////////////////////////////////////////////////////////////////////////////////
thomasmorris 28:3193157ebb0c 236 if ((_Function == 2 || _Function == 3) & _System_Running == 0)//Twist selected
thomasmorris 23:07a368f2cdb1 237 {
thomasmorris 28:3193157ebb0c 238 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 239 _System_Running = 1;//Code is running
thomasmorris 28:3193157ebb0c 240 _System_Running_mutex.unlock();
thomasmorris 24:728de4bf961e 241
thomasmorris 23:07a368f2cdb1 242 _Twist_Go_mutex.lock();
thomasmorris 23:07a368f2cdb1 243 _Twist_Go = true;//toggle used for coiling and twisting and Running the code
thomasmorris 23:07a368f2cdb1 244 _Twist_Go_mutex.unlock();
thomasmorris 24:728de4bf961e 245
thomasmorris 23:07a368f2cdb1 246 }
thomasmorris 28:3193157ebb0c 247 else if (_Function == 0 & _System_Running == 0) //Annealing selected
thomasmorris 23:07a368f2cdb1 248 {
thomasmorris 28:3193157ebb0c 249 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 250 _System_Running = 1;//Code is running
thomasmorris 28:3193157ebb0c 251 _System_Running_mutex.unlock();
thomasmorris 24:728de4bf961e 252
thomasmorris 23:07a368f2cdb1 253 _Anneal_Go_mutex.lock();
thomasmorris 23:07a368f2cdb1 254 _Anneal_Go = true;//toggle and Run the code
thomasmorris 23:07a368f2cdb1 255 _Anneal_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 256 }
thomasmorris 28:3193157ebb0c 257 else if (_Function == 1 & _System_Running == 0) //Testing selected
thomasmorris 16:9f98ec0ededb 258 {
thomasmorris 28:3193157ebb0c 259 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 260 _System_Running = 1;//Code is running
thomasmorris 28:3193157ebb0c 261 _System_Running_mutex.unlock();
thomasmorris 28:3193157ebb0c 262
thomasmorris 23:07a368f2cdb1 263 _Test_Go_mutex.lock();
thomasmorris 23:07a368f2cdb1 264 _Test_Go = true;//toggle and run the code
thomasmorris 23:07a368f2cdb1 265 _Test_Go_mutex.unlock();
thomasmorris 16:9f98ec0ededb 266 }
thomasmorris 28:3193157ebb0c 267 ///////////////////////////////////////
thomasmorris 28:3193157ebb0c 268
thomasmorris 28:3193157ebb0c 269 //System Running cases run to pause the code
thomasmorris 28:3193157ebb0c 270 else if ((_Function == 2 || _Function == 3) & _System_Running == 1)//Coiling / Twisting selected to be paused
thomasmorris 23:07a368f2cdb1 271 {
thomasmorris 23:07a368f2cdb1 272 _Twist_Stop_mutex.lock();
thomasmorris 23:07a368f2cdb1 273 _Twist_Stop = true;
thomasmorris 23:07a368f2cdb1 274 _Twist_Stop_mutex.unlock();
thomasmorris 25:9751619fa030 275
thomasmorris 25:9751619fa030 276 if(_Function == 2)
thomasmorris 25:9751619fa030 277 {
thomasmorris 25:9751619fa030 278 printf("Coiling Code Paused\n");
thomasmorris 25:9751619fa030 279 }
thomasmorris 25:9751619fa030 280 if(_Function == 3)
thomasmorris 25:9751619fa030 281 {
thomasmorris 25:9751619fa030 282 printf("Twisting Code Paused\n");
thomasmorris 25:9751619fa030 283 }
thomasmorris 23:07a368f2cdb1 284 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 285 _System_Running = 2;
thomasmorris 23:07a368f2cdb1 286 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 287 STEPPER_MOTOR_1.Pause_Code();
thomasmorris 23:07a368f2cdb1 288 }
thomasmorris 25:9751619fa030 289 else if (_Function == 0 & _System_Running == 1) //Annealing selected to be stopped
thomasmorris 23:07a368f2cdb1 290 {
thomasmorris 23:07a368f2cdb1 291 _Anneal_Stop_mutex.lock();
thomasmorris 23:07a368f2cdb1 292 _Anneal_Stop = true;
thomasmorris 23:07a368f2cdb1 293 _Anneal_Stop_mutex.unlock();
thomasmorris 23:07a368f2cdb1 294 printf("Annealing Code Paused\n");
thomasmorris 23:07a368f2cdb1 295 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 296 _System_Running = 2;//Pause code
thomasmorris 23:07a368f2cdb1 297 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 298 }
thomasmorris 28:3193157ebb0c 299 else if (_Function == 1 & _System_Running == 1) //Testing selected to be paused
thomasmorris 16:9f98ec0ededb 300 {
thomasmorris 23:07a368f2cdb1 301 _Test_Stop_mutex.lock();
thomasmorris 23:07a368f2cdb1 302 _Test_Stop = true;
thomasmorris 23:07a368f2cdb1 303 _Test_Stop_mutex.unlock();
thomasmorris 24:728de4bf961e 304
thomasmorris 23:07a368f2cdb1 305 printf("Testing Code Paused\n");
thomasmorris 24:728de4bf961e 306
thomasmorris 23:07a368f2cdb1 307 _Tendon_mutex.lock();
thomasmorris 23:07a368f2cdb1 308 Tendon_Power=0;
thomasmorris 23:07a368f2cdb1 309 _Tendon_mutex.unlock();
thomasmorris 23:07a368f2cdb1 310
thomasmorris 23:07a368f2cdb1 311 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 312 _System_Running = 2;//Pause code
thomasmorris 23:07a368f2cdb1 313 _System_Running_mutex.unlock();
thomasmorris 16:9f98ec0ededb 314 }
thomasmorris 28:3193157ebb0c 315
thomasmorris 28:3193157ebb0c 316 ////////////////
thomasmorris 28:3193157ebb0c 317 //System Paused cases run to unpause
thomasmorris 28:3193157ebb0c 318 else if ((_Function == 2 || _Function == 3) & _System_Running == 2)//Coil Twist selected to be unpaused
thomasmorris 23:07a368f2cdb1 319 {
thomasmorris 28:3193157ebb0c 320 _Twist_Stop_mutex.lock();
thomasmorris 28:3193157ebb0c 321 _Twist_Stop = false;
thomasmorris 28:3193157ebb0c 322 _Twist_Stop_mutex.unlock();
thomasmorris 28:3193157ebb0c 323
thomasmorris 23:07a368f2cdb1 324 _Twist_Go_mutex.lock();
thomasmorris 23:07a368f2cdb1 325 _Twist_Go = true;//toggle used for coiling and twisting and Running the code
thomasmorris 23:07a368f2cdb1 326 _Twist_Go_mutex.unlock();
thomasmorris 28:3193157ebb0c 327
thomasmorris 28:3193157ebb0c 328 STEPPER_MOTOR_1.Unpause_Code();
thomasmorris 28:3193157ebb0c 329
thomasmorris 28:3193157ebb0c 330 if(_Function == 2)//Coiling
thomasmorris 28:3193157ebb0c 331 {
thomasmorris 28:3193157ebb0c 332 printf("Coiling Code unpaused\n");
thomasmorris 28:3193157ebb0c 333 }
thomasmorris 28:3193157ebb0c 334 if(_Function == 3)//Twisiting
thomasmorris 28:3193157ebb0c 335 {
thomasmorris 28:3193157ebb0c 336 printf("Twisting Code unpaused\n");
thomasmorris 28:3193157ebb0c 337 }
thomasmorris 28:3193157ebb0c 338 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 339 _System_Running = 1;//Code is unpaused
thomasmorris 28:3193157ebb0c 340 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 341 }
thomasmorris 28:3193157ebb0c 342 else if (_Function == 0 & _System_Running == 2) //Annealing selected to be unpaused
thomasmorris 16:9f98ec0ededb 343 {
thomasmorris 28:3193157ebb0c 344 _Anneal_Stop_mutex.lock();
thomasmorris 28:3193157ebb0c 345 _Anneal_Stop = false;
thomasmorris 28:3193157ebb0c 346 _Anneal_Stop_mutex.unlock();
thomasmorris 28:3193157ebb0c 347 printf("Annealing Code unpaused\n");
thomasmorris 28:3193157ebb0c 348
thomasmorris 23:07a368f2cdb1 349 _Anneal_Go_mutex.lock();
thomasmorris 23:07a368f2cdb1 350 _Anneal_Go = true;//toggle and Run the code
thomasmorris 23:07a368f2cdb1 351 _Anneal_Go_mutex.unlock();
thomasmorris 28:3193157ebb0c 352 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 353 _System_Running = 1;//Code is unpaused
thomasmorris 28:3193157ebb0c 354 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 355 }
thomasmorris 28:3193157ebb0c 356 else if (_Function == 1 & _System_Running == 2) //Testing selected to be re run
thomasmorris 23:07a368f2cdb1 357 {
thomasmorris 28:3193157ebb0c 358 _Test_Stop_mutex.lock();
thomasmorris 28:3193157ebb0c 359 _Test_Stop = false;
thomasmorris 28:3193157ebb0c 360 _Test_Stop_mutex.unlock();
thomasmorris 28:3193157ebb0c 361 printf("Testing Code unpaused\n");
thomasmorris 23:07a368f2cdb1 362 _Test_Go_mutex.lock();
thomasmorris 23:07a368f2cdb1 363 _Test_Go = true;//toggle and run the code
thomasmorris 23:07a368f2cdb1 364 _Test_Go_mutex.unlock();
thomasmorris 28:3193157ebb0c 365 _System_Running_mutex.lock();
thomasmorris 28:3193157ebb0c 366 _System_Running = 1;//Code is unpaused
thomasmorris 28:3193157ebb0c 367 _System_Running_mutex.unlock();
thomasmorris 16:9f98ec0ededb 368 }
thomasmorris 16:9f98ec0ededb 369 }
thomasmorris 17:68b3fdabe4c5 370 void INTERFACE::Function()//Function Routine used to increment through the three functions
thomasmorris 16:9f98ec0ededb 371 {
thomasmorris 17:68b3fdabe4c5 372 /*
thomasmorris 25:9751619fa030 373 Function 0 = Anneal
thomasmorris 25:9751619fa030 374 Function 1 = Test
thomasmorris 25:9751619fa030 375 Function 2 = Coiling
thomasmorris 25:9751619fa030 376 Function 3 = Twisting
thomasmorris 17:68b3fdabe4c5 377 */
thomasmorris 29:f3b1387c81f1 378 if(_Type_of_Rig == 3)//Twisting
thomasmorris 26:83550fc299aa 379 {
thomasmorris 29:f3b1387c81f1 380 _Function = 3;
thomasmorris 26:83550fc299aa 381 }
thomasmorris 29:f3b1387c81f1 382 if(_Type_of_Rig == 2)
thomasmorris 25:9751619fa030 383 {
thomasmorris 25:9751619fa030 384 if(_Function < 2)
thomasmorris 25:9751619fa030 385 {
thomasmorris 25:9751619fa030 386 _Function_mutex.lock();
thomasmorris 26:83550fc299aa 387 _Function = _Function + 1;
thomasmorris 26:83550fc299aa 388 _Function_mutex.unlock();
thomasmorris 25:9751619fa030 389 }
thomasmorris 25:9751619fa030 390 else if(_Function == 2)
thomasmorris 25:9751619fa030 391 {
thomasmorris 26:83550fc299aa 392 _Function = 0;
thomasmorris 25:9751619fa030 393 }
thomasmorris 16:9f98ec0ededb 394 }
thomasmorris 16:9f98ec0ededb 395 }
thomasmorris 17:68b3fdabe4c5 396 void INTERFACE::Select()//Select Routine
thomasmorris 16:9f98ec0ededb 397 {
thomasmorris 23:07a368f2cdb1 398 _Select_mutex.lock();
thomasmorris 26:83550fc299aa 399 if(_Function == 0)//Anneal
thomasmorris 25:9751619fa030 400 {
thomasmorris 26:83550fc299aa 401 printf("Select Value is :%d\n",_Select);
thomasmorris 26:83550fc299aa 402 if(_Select == 2)
thomasmorris 26:83550fc299aa 403 {
thomasmorris 26:83550fc299aa 404 _Select = 0;
thomasmorris 26:83550fc299aa 405 }
thomasmorris 26:83550fc299aa 406 else if(_Select == 1)
thomasmorris 26:83550fc299aa 407 {
thomasmorris 26:83550fc299aa 408 _Select = 2;
thomasmorris 26:83550fc299aa 409 }
thomasmorris 26:83550fc299aa 410 else if(_Select == 0)
thomasmorris 26:83550fc299aa 411 {
thomasmorris 26:83550fc299aa 412 _Select = 1;
thomasmorris 26:83550fc299aa 413 }
thomasmorris 26:83550fc299aa 414 if(_Select == 0 || _Select == 2)
thomasmorris 26:83550fc299aa 415 {
thomasmorris 26:83550fc299aa 416 Led_Select_Left_mutex.lock();
thomasmorris 26:83550fc299aa 417 Led_Select_Left = 0;
thomasmorris 26:83550fc299aa 418 Led_Select_Left_mutex.unlock();
thomasmorris 26:83550fc299aa 419
thomasmorris 26:83550fc299aa 420 Led_Select_Right_mutex.lock();
thomasmorris 26:83550fc299aa 421 Led_Select_Right= 1;
thomasmorris 26:83550fc299aa 422 Led_Select_Right_mutex.unlock();
thomasmorris 26:83550fc299aa 423 }
thomasmorris 26:83550fc299aa 424 else if(_Select == 1)
thomasmorris 26:83550fc299aa 425 {
thomasmorris 26:83550fc299aa 426 Led_Select_Left_mutex.lock();
thomasmorris 26:83550fc299aa 427 Led_Select_Left = 1;
thomasmorris 26:83550fc299aa 428 Led_Select_Left_mutex.unlock();
thomasmorris 26:83550fc299aa 429
thomasmorris 26:83550fc299aa 430 Led_Select_Right_mutex.lock();
thomasmorris 26:83550fc299aa 431 Led_Select_Right= 0;
thomasmorris 26:83550fc299aa 432 Led_Select_Right_mutex.unlock();
thomasmorris 26:83550fc299aa 433 }
thomasmorris 26:83550fc299aa 434 printf("Select Value is :%d\n",_Select);
thomasmorris 25:9751619fa030 435 }
thomasmorris 26:83550fc299aa 436 else if(_Function == 1)//Test
thomasmorris 23:07a368f2cdb1 437 {
thomasmorris 26:83550fc299aa 438 if(_Select == 0)
thomasmorris 26:83550fc299aa 439 {
thomasmorris 26:83550fc299aa 440 _Select = 1;
thomasmorris 26:83550fc299aa 441 }
thomasmorris 26:83550fc299aa 442 else if(_Select == 1)
thomasmorris 26:83550fc299aa 443 {
thomasmorris 26:83550fc299aa 444 _Select = 0;
thomasmorris 26:83550fc299aa 445 }
thomasmorris 23:07a368f2cdb1 446
thomasmorris 26:83550fc299aa 447 if(_Select == 0)
thomasmorris 26:83550fc299aa 448 {
thomasmorris 26:83550fc299aa 449 Led_Select_Left_mutex.lock();
thomasmorris 26:83550fc299aa 450 Led_Select_Left = 0;
thomasmorris 26:83550fc299aa 451 Led_Select_Left_mutex.unlock();
thomasmorris 26:83550fc299aa 452
thomasmorris 26:83550fc299aa 453 Led_Select_Right_mutex.lock();
thomasmorris 26:83550fc299aa 454 Led_Select_Right= 1;
thomasmorris 26:83550fc299aa 455 Led_Select_Right_mutex.unlock();
thomasmorris 26:83550fc299aa 456 }
thomasmorris 26:83550fc299aa 457 else if(_Select ==1)
thomasmorris 26:83550fc299aa 458 {
thomasmorris 26:83550fc299aa 459 Led_Select_Left_mutex.lock();
thomasmorris 26:83550fc299aa 460 Led_Select_Left = 1;
thomasmorris 26:83550fc299aa 461 Led_Select_Left_mutex.unlock();
thomasmorris 26:83550fc299aa 462
thomasmorris 26:83550fc299aa 463 Led_Select_Right_mutex.lock();
thomasmorris 26:83550fc299aa 464 Led_Select_Right= 0;
thomasmorris 26:83550fc299aa 465 Led_Select_Right_mutex.unlock();
thomasmorris 26:83550fc299aa 466 }
thomasmorris 21:6d9f6a986647 467 }
thomasmorris 29:f3b1387c81f1 468 else if(_Function == 2 || _Function == 3)//Coiling and Twisting
thomasmorris 21:6d9f6a986647 469 {
thomasmorris 29:f3b1387c81f1 470 if(_Select == 0)//Toggle code for select
thomasmorris 29:f3b1387c81f1 471 {
thomasmorris 29:f3b1387c81f1 472 _Select = 1;
thomasmorris 29:f3b1387c81f1 473 }
thomasmorris 29:f3b1387c81f1 474 else if(_Select == 1)
thomasmorris 29:f3b1387c81f1 475 {
thomasmorris 29:f3b1387c81f1 476 _Select = 0;
thomasmorris 29:f3b1387c81f1 477 }
thomasmorris 23:07a368f2cdb1 478
thomasmorris 29:f3b1387c81f1 479 if(_Select == 0)
thomasmorris 29:f3b1387c81f1 480 {
thomasmorris 29:f3b1387c81f1 481 Led_Select_Left_mutex.lock();
thomasmorris 29:f3b1387c81f1 482 Led_Select_Left = 0;
thomasmorris 29:f3b1387c81f1 483 Led_Select_Left_mutex.unlock();
thomasmorris 29:f3b1387c81f1 484
thomasmorris 29:f3b1387c81f1 485 Led_Select_Right_mutex.lock();
thomasmorris 29:f3b1387c81f1 486 Led_Select_Right= 1;
thomasmorris 29:f3b1387c81f1 487 Led_Select_Right_mutex.unlock();
thomasmorris 29:f3b1387c81f1 488 }
thomasmorris 29:f3b1387c81f1 489 else if(_Select == 1)
thomasmorris 29:f3b1387c81f1 490 {
thomasmorris 29:f3b1387c81f1 491 Led_Select_Left_mutex.lock();
thomasmorris 29:f3b1387c81f1 492 Led_Select_Left = 1;
thomasmorris 29:f3b1387c81f1 493 Led_Select_Left_mutex.unlock();
thomasmorris 29:f3b1387c81f1 494
thomasmorris 29:f3b1387c81f1 495 Led_Select_Right_mutex.lock();
thomasmorris 29:f3b1387c81f1 496 Led_Select_Right= 0;
thomasmorris 29:f3b1387c81f1 497 Led_Select_Right_mutex.unlock();
thomasmorris 29:f3b1387c81f1 498 }
thomasmorris 21:6d9f6a986647 499 }
thomasmorris 26:83550fc299aa 500 _Select_mutex.unlock();
thomasmorris 16:9f98ec0ededb 501 }
thomasmorris 17:68b3fdabe4c5 502 void INTERFACE::Interface_main()//Main Routine to execute commands when the start button has been pressed
thomasmorris 16:9f98ec0ededb 503 {
thomasmorris 28:3193157ebb0c 504 if (_Function == 2 || _Function == 3) //Turning Code for coiling and twisting
thomasmorris 16:9f98ec0ededb 505 {
thomasmorris 16:9f98ec0ededb 506 if (_Twist_Go == true)
thomasmorris 16:9f98ec0ededb 507 {
thomasmorris 23:07a368f2cdb1 508 Led_Power_mutex.lock();
thomasmorris 21:6d9f6a986647 509 Led_Power = 1;
thomasmorris 23:07a368f2cdb1 510 Led_Power_mutex.unlock();
thomasmorris 23:07a368f2cdb1 511
thomasmorris 23:07a368f2cdb1 512 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 513 _System_Running = 1;
thomasmorris 23:07a368f2cdb1 514 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 515
thomasmorris 29:f3b1387c81f1 516 STEPPER_MOTOR_1.Rotate_Steps(_Turns_Todo,_Function,_Direction);//Rotates for the specified number of steps given
thomasmorris 23:07a368f2cdb1 517
thomasmorris 23:07a368f2cdb1 518 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 519 _System_Running = 0;
thomasmorris 23:07a368f2cdb1 520 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 521
thomasmorris 23:07a368f2cdb1 522
thomasmorris 23:07a368f2cdb1 523 _Twist_Go_mutex.lock();
thomasmorris 17:68b3fdabe4c5 524 _Twist_Go = false;
thomasmorris 23:07a368f2cdb1 525 _Twist_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 526
thomasmorris 23:07a368f2cdb1 527 Led_Power_mutex.lock();
thomasmorris 21:6d9f6a986647 528 Led_Power = 0;
thomasmorris 23:07a368f2cdb1 529 Led_Power_mutex.unlock();
thomasmorris 16:9f98ec0ededb 530 }
thomasmorris 16:9f98ec0ededb 531 }
thomasmorris 25:9751619fa030 532 else if (_Function == 0) //Annealing Code
thomasmorris 16:9f98ec0ededb 533 {
thomasmorris 16:9f98ec0ededb 534 if (_Anneal_Go == true)
thomasmorris 16:9f98ec0ededb 535 {
thomasmorris 23:07a368f2cdb1 536 Led_Power_mutex.lock();
thomasmorris 21:6d9f6a986647 537 Led_Power = 1;
thomasmorris 23:07a368f2cdb1 538 Led_Power_mutex.unlock();
thomasmorris 23:07a368f2cdb1 539
thomasmorris 23:07a368f2cdb1 540 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 541 _System_Running = 1;
thomasmorris 23:07a368f2cdb1 542 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 543
thomasmorris 16:9f98ec0ededb 544 for ( int counter = 0; counter < _Loop; counter++) //Loop value, check if works
thomasmorris 16:9f98ec0ededb 545 {
thomasmorris 23:07a368f2cdb1 546 if(_System_Running == 1)
thomasmorris 23:07a368f2cdb1 547 {
thomasmorris 23:07a368f2cdb1 548 _Tendon_mutex.lock();
thomasmorris 23:07a368f2cdb1 549 Tendon_Power.period(0.01); // set PWM period to 10 ms don't use pwm have this just to declare
thomasmorris 23:07a368f2cdb1 550 Tendon_Power=1; // set duty cycle to 100%
thomasmorris 25:9751619fa030 551 _On_Time_mutex.lock();
thomasmorris 25:9751619fa030 552 wait(_On_Time);//Variable
thomasmorris 25:9751619fa030 553 _On_Time_mutex.unlock();
thomasmorris 23:07a368f2cdb1 554 Tendon_Power=0; // set duty cycle to 0%
thomasmorris 25:9751619fa030 555 _Off_Time_mutex.lock();
thomasmorris 25:9751619fa030 556 wait(_Off_Time);//Fixed off time
thomasmorris 25:9751619fa030 557 _Off_Time_mutex.unlock();
thomasmorris 23:07a368f2cdb1 558 _Tendon_mutex.unlock();
thomasmorris 23:07a368f2cdb1 559 }
thomasmorris 23:07a368f2cdb1 560 while(_System_Running == 2)//Stops the system and just spins in this while loop until system running is not paused
thomasmorris 23:07a368f2cdb1 561 {
thomasmorris 23:07a368f2cdb1 562 _Tendon_mutex.lock();
thomasmorris 23:07a368f2cdb1 563 Tendon_Power =0;
thomasmorris 23:07a368f2cdb1 564 _Tendon_mutex.unlock();
thomasmorris 23:07a368f2cdb1 565 }
thomasmorris 16:9f98ec0ededb 566 }
thomasmorris 23:07a368f2cdb1 567
thomasmorris 23:07a368f2cdb1 568 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 569 _System_Running = 0;
thomasmorris 23:07a368f2cdb1 570 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 571
thomasmorris 23:07a368f2cdb1 572 _Anneal_Go_mutex.lock();
thomasmorris 17:68b3fdabe4c5 573 _Anneal_Go = false;
thomasmorris 23:07a368f2cdb1 574 _Anneal_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 575
thomasmorris 23:07a368f2cdb1 576 Led_Power_mutex.lock();
thomasmorris 21:6d9f6a986647 577 Led_Power = 0;
thomasmorris 23:07a368f2cdb1 578 Led_Power_mutex.unlock();
thomasmorris 16:9f98ec0ededb 579 }
thomasmorris 16:9f98ec0ededb 580 }
thomasmorris 25:9751619fa030 581 else if (_Function == 1) //Testing Code //This code is paused / unpaused in start / stop note this code is not paused it is re run.
thomasmorris 16:9f98ec0ededb 582 {
thomasmorris 16:9f98ec0ededb 583 if (_Test_Go == true)
thomasmorris 16:9f98ec0ededb 584 {
thomasmorris 23:07a368f2cdb1 585 Led_Power_mutex.lock();
thomasmorris 21:6d9f6a986647 586 Led_Power = 1;
thomasmorris 23:07a368f2cdb1 587 Led_Power_mutex.unlock();
thomasmorris 23:07a368f2cdb1 588
thomasmorris 23:07a368f2cdb1 589 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 590 _System_Running = 1;
thomasmorris 23:07a368f2cdb1 591 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 592
thomasmorris 23:07a368f2cdb1 593 _Tendon_mutex.lock();
thomasmorris 16:9f98ec0ededb 594 Tendon_Power.period(0.01); // set PWM period to 10 ms don't use pwm have this just to declare
thomasmorris 16:9f98ec0ededb 595 Tendon_Power= _Duty_Cycle / 100; // set duty cycle to variable input from buttons between 0-1 (on lcd this is a percentage) also increment by values of 10
thomasmorris 16:9f98ec0ededb 596 wait(_Power_Time);//Variable on time for power on
thomasmorris 16:9f98ec0ededb 597 Tendon_Power=0; // set duty cycle to 0% and power off
thomasmorris 23:07a368f2cdb1 598 _Tendon_mutex.unlock();
thomasmorris 23:07a368f2cdb1 599
thomasmorris 23:07a368f2cdb1 600 _System_Running_mutex.lock();
thomasmorris 23:07a368f2cdb1 601 _System_Running = 0;
thomasmorris 23:07a368f2cdb1 602 _System_Running_mutex.unlock();
thomasmorris 23:07a368f2cdb1 603
thomasmorris 23:07a368f2cdb1 604 _Test_Go_mutex.lock();
thomasmorris 17:68b3fdabe4c5 605 _Test_Go = false;
thomasmorris 23:07a368f2cdb1 606 _Test_Go_mutex.unlock();
thomasmorris 23:07a368f2cdb1 607
thomasmorris 23:07a368f2cdb1 608 Led_Power_mutex.lock();
thomasmorris 21:6d9f6a986647 609 Led_Power = 0;
thomasmorris 23:07a368f2cdb1 610 Led_Power_mutex.unlock();
thomasmorris 16:9f98ec0ededb 611 }
thomasmorris 16:9f98ec0ededb 612 }
thomasmorris 16:9f98ec0ededb 613 }
thomasmorris 17:68b3fdabe4c5 614 //Setter functions
thomasmorris 23:07a368f2cdb1 615 void INTERFACE::Set_System_Running(int System_Running){_System_Running_mutex.lock(); _System_Running = System_Running; _System_Running_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 616 void INTERFACE::Set_Function(int Function){_Function_mutex.lock();_Function = Function;_Function_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 617 void INTERFACE::Set_Twist_Go(bool Twist_Go){_Twist_Go_mutex.lock();_Twist_Go = Twist_Go;_Twist_Go_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 618 void INTERFACE::Set_Anneal_Go(bool Anneal_Go){_Anneal_Go_mutex.lock();_Anneal_Go = Anneal_Go;_Anneal_Go_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 619 void INTERFACE::Set_Test_Go(bool Test_Go){_Test_Go_mutex.lock();_Test_Go = Test_Go;_Test_Go_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 620 void INTERFACE::Set_Twist_Stop(bool Twist_Stop){_Twist_Stop_mutex.lock();_Twist_Stop = Twist_Stop;_Twist_Stop_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 621 void INTERFACE::Set_Anneal_Stop(bool Anneal_Stop){_Anneal_Stop_mutex.lock();_Anneal_Stop = Anneal_Stop;_Anneal_Stop_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 622 void INTERFACE::Set_Test_Stop(bool Test_Stop){_Test_Stop_mutex.lock();_Test_Go = Test_Stop;_Test_Stop_mutex.unlock();}
thomasmorris 25:9751619fa030 623 void INTERFACE::Set_Select(int Select){_Select_mutex.lock();_Select = Select;_Select_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 624 void INTERFACE::Set_Turns_Done(int Turns_Done){_Turns_Done_mutex.lock();_Turns_Done = Turns_Done;_Turns_Done_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 625 void INTERFACE::Set_Turns_To_Do(int Turns_Todo){_Turns_Todo_mutex.lock();_Turns_Todo = Turns_Todo;_Turns_Todo_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 626 void INTERFACE::Set_Loop(int Loop){_Loop_mutex.lock();Loop = Loop;_Loop_mutex.unlock();}
thomasmorris 25:9751619fa030 627 void INTERFACE::Set_On_Time(int On_Time){_On_Time_mutex.lock();_On_Time = On_Time;_On_Time_mutex.unlock();}
thomasmorris 25:9751619fa030 628 void INTERFACE::Set_Off_Time(int Off_Time){_Off_Time_mutex.lock();_Off_Time = Off_Time;_Off_Time_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 629 void INTERFACE::Set_Duty_Cycle(int Duty_Cycle){_Duty_Cycle_mutex.lock();_Duty_Cycle = Duty_Cycle;_Duty_Cycle_mutex.unlock();}
thomasmorris 23:07a368f2cdb1 630 void INTERFACE::Set_Power_Time(float Power_Time){_Power_Time_mutex.lock();_Power_Time = Power_Time;_Power_Time_mutex.unlock();}
thomasmorris 29:f3b1387c81f1 631 void INTERFACE::Set_Direction(bool Direction){_Direction_mutex.lock();_Direction = Direction;_Direction_mutex.unlock();}
thomasmorris 17:68b3fdabe4c5 632 //Getter functions
thomasmorris 23:07a368f2cdb1 633 int INTERFACE::Get_System_Running(){return _System_Running;}
thomasmorris 23:07a368f2cdb1 634 int INTERFACE::Get_Function(){return _Function;}
thomasmorris 16:9f98ec0ededb 635 bool INTERFACE::Get_Twist_Go(){return _Twist_Go;}
thomasmorris 16:9f98ec0ededb 636 bool INTERFACE::Get_Anneal_Go(){return _Anneal_Go;}
thomasmorris 16:9f98ec0ededb 637 bool INTERFACE::Get_Test_Go(){return _Test_Go;}
thomasmorris 23:07a368f2cdb1 638 bool INTERFACE::Get_Twist_Stop(){return _Twist_Stop;}
thomasmorris 23:07a368f2cdb1 639 bool INTERFACE::Get_Anneal_Stop(){return _Anneal_Stop;}
thomasmorris 23:07a368f2cdb1 640 bool INTERFACE::Get_Test_Stop(){return _Test_Stop;}
thomasmorris 25:9751619fa030 641 int INTERFACE::Get_Select(){return _Select;}
thomasmorris 18:3523660f3930 642 int INTERFACE::Get_Turns_Done(){_Turns_Done = STEPPER_MOTOR_1.Get_Turns(); return _Turns_Done;}
thomasmorris 16:9f98ec0ededb 643 int INTERFACE::Get_Turns_To_Do(){return _Turns_Todo;}
thomasmorris 16:9f98ec0ededb 644 int INTERFACE::Get_Loop(){return _Loop;}
thomasmorris 25:9751619fa030 645 int INTERFACE::Get_On_Time(){return _On_Time;}
thomasmorris 25:9751619fa030 646 int INTERFACE::Get_Off_Time(){return _Off_Time;}
thomasmorris 16:9f98ec0ededb 647 int INTERFACE::Get_Duty_Cycle(){return _Duty_Cycle;}
thomasmorris 29:f3b1387c81f1 648 int INTERFACE::Get_Power_Time(){return _Power_Time;}
thomasmorris 29:f3b1387c81f1 649 bool INTERFACE::Get_Direction(){return _Direction;}