aa

Dependencies:   mbed

Committer:
M_souta
Date:
Tue Aug 27 04:33:08 2019 +0000
Revision:
20:eae8c84f318c
Parent:
19:96a462583af9
Child:
21:e3b58d675c1c
ttsts

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kishibekairohan 13:b6e02d6261d7 1
t_yamamoto 0:669ef71cba68 2 #include "mbed.h"
t_yamamoto 0:669ef71cba68 3 #include "Process.h"
7ka884 4:ba9df71868df 4 #include "QEI.h"
t_yamamoto 0:669ef71cba68 5
7ka884 4:ba9df71868df 6 #include "../../CommonLibraries/PID/PID.h"
t_yamamoto 0:669ef71cba68 7 #include "../../Communication/RS485/ActuatorHub/ActuatorHub.h"
t_yamamoto 0:669ef71cba68 8 #include "../../Communication/Controller/Controller.h"
t_yamamoto 0:669ef71cba68 9 #include "../../Input/ExternalInt/ExternalInt.h"
t_yamamoto 0:669ef71cba68 10 #include "../../Input/Switch/Switch.h"
t_yamamoto 0:669ef71cba68 11 #include "../../Input/Potentiometer/Potentiometer.h"
kishibekairohan 16:3f2c2d89372b 12 #include "../../Input/Encoder/Encoder.h"
t_yamamoto 0:669ef71cba68 13 #include "../../LED/LED.h"
t_yamamoto 0:669ef71cba68 14 #include "../../Safty/Safty.h"
t_yamamoto 0:669ef71cba68 15 #include "../Using.h"
t_yamamoto 0:669ef71cba68 16
t_yamamoto 0:669ef71cba68 17 using namespace SWITCH;
7ka884 4:ba9df71868df 18 using namespace PID_SPACE;
kishibekairohan 16:3f2c2d89372b 19 using namespace ENCODER;
t_yamamoto 0:669ef71cba68 20
t_yamamoto 0:669ef71cba68 21 static CONTROLLER::ControllerData *controller;
t_yamamoto 0:669ef71cba68 22 ACTUATORHUB::MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM];
t_yamamoto 0:669ef71cba68 23 ACTUATORHUB::SOLENOID::SolenoidStatus solenoid;
t_yamamoto 0:669ef71cba68 24
t_yamamoto 0:669ef71cba68 25 static bool lock;
t_yamamoto 0:669ef71cba68 26 static bool processChangeComp;
t_yamamoto 0:669ef71cba68 27 static int current;
t_yamamoto 0:669ef71cba68 28
t_yamamoto 0:669ef71cba68 29 static void AllActuatorReset();
t_yamamoto 0:669ef71cba68 30
t_yamamoto 0:669ef71cba68 31 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 32 static void (*Process[USE_PROCESS_NUM])(void);
t_yamamoto 0:669ef71cba68 33 #endif
t_yamamoto 0:669ef71cba68 34
t_yamamoto 0:669ef71cba68 35 #pragma region USER-DEFINED_VARIABLES_AND_PROTOTYPE
t_yamamoto 0:669ef71cba68 36
t_yamamoto 0:669ef71cba68 37 /*Replace here with the definition code of your variables.*/
t_yamamoto 0:669ef71cba68 38
kishibekairohan 2:c015739085d3 39 Serial pc(USBTX, USBRX);
kishibekairohan 2:c015739085d3 40
kishibekairohan 16:3f2c2d89372b 41 //**************Encoder***************
kishibekairohan 16:3f2c2d89372b 42 const int PerRev = 256;
kishibekairohan 16:3f2c2d89372b 43 QEI ECD_0(ECD_A_0,ECD_B_0,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 44 QEI ECD_1(ECD_A_1,ECD_B_1,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 45 QEI ECD_2(ECD_A_2,ECD_B_2,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 46 QEI ECD_3(ECD_A_3,ECD_B_3,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 47 //**************Encoder***************
kishibekairohan 7:e88c5d47a3be 48
kishibekairohan 16:3f2c2d89372b 49 //**************Buzzer****************
kishibekairohan 11:028a150943b5 50 //DigitalOut buzzer(BUZZER_PIN);
kishibekairohan 9:f93fc79a49ea 51 void BuzzerTimer_func();
kishibekairohan 9:f93fc79a49ea 52 Ticker BuzzerTimer;
kishibekairohan 16:3f2c2d89372b 53 bool EMGflag = false;
kishibekairohan 16:3f2c2d89372b 54 PwmOut buzzer(BUZZER_PIN);
kishibekairohan 16:3f2c2d89372b 55 //**************Buzzer****************
kishibekairohan 11:028a150943b5 56
kishibekairohan 11:028a150943b5 57 //************TapeLed*****************
kishibekairohan 11:028a150943b5 58 void TapeLedEms_func();
kishibekairohan 11:028a150943b5 59 TapeLedData tapeLED;
kishibekairohan 11:028a150943b5 60 TapeLedData sendLedData;
kishibekairohan 11:028a150943b5 61 TapeLED_Mode ledMode = Normal;
kishibekairohan 11:028a150943b5 62 Ticker tapeLedTimer;
kishibekairohan 11:028a150943b5 63 //************TapaLed*****************
kishibekairohan 16:3f2c2d89372b 64
M_souta 20:eae8c84f318c 65 /*************LineHub****************
M_souta 20:eae8c84f318c 66 Serial linehubUart(PC_10,PC_11);
M_souta 20:eae8c84f318c 67 char data[6];
M_souta 20:eae8c84f318c 68
M_souta 20:eae8c84f318c 69 void LineRead()
M_souta 20:eae8c84f318c 70 {
M_souta 20:eae8c84f318c 71 //__disable_irq();
M_souta 20:eae8c84f318c 72 if(linehubUart.readable()) {
M_souta 20:eae8c84f318c 73 for(int i=0; i<=5; i++) {
M_souta 20:eae8c84f318c 74 data[i] = linehubUart.getc();
M_souta 20:eae8c84f318c 75 }
M_souta 20:eae8c84f318c 76 }
M_souta 20:eae8c84f318c 77 //__enable_irq();
M_souta 20:eae8c84f318c 78 }
M_souta 20:eae8c84f318c 79
M_souta 20:eae8c84f318c 80 //*************LineHub****************/
M_souta 20:eae8c84f318c 81
M_souta 18:c694bae76e51 82 float tireProRPM[4];
M_souta 18:c694bae76e51 83 float tireTarRPM[4];
M_souta 19:96a462583af9 84 float tirePWM[4];
M_souta 18:c694bae76e51 85
t_yamamoto 0:669ef71cba68 86 #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE
t_yamamoto 0:669ef71cba68 87
t_yamamoto 0:669ef71cba68 88 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 89 #if USE_PROCESS_NUM>0
t_yamamoto 0:669ef71cba68 90 static void Process0(void);
t_yamamoto 0:669ef71cba68 91 #endif
t_yamamoto 0:669ef71cba68 92 #if USE_PROCESS_NUM>1
t_yamamoto 0:669ef71cba68 93 static void Process1(void);
t_yamamoto 0:669ef71cba68 94 #endif
t_yamamoto 0:669ef71cba68 95 #if USE_PROCESS_NUM>2
t_yamamoto 0:669ef71cba68 96 static void Process2(void);
t_yamamoto 0:669ef71cba68 97 #endif
t_yamamoto 0:669ef71cba68 98 #if USE_PROCESS_NUM>3
t_yamamoto 0:669ef71cba68 99 static void Process3(void);
t_yamamoto 0:669ef71cba68 100 #endif
t_yamamoto 0:669ef71cba68 101 #if USE_PROCESS_NUM>4
t_yamamoto 0:669ef71cba68 102 static void Process4(void);
t_yamamoto 0:669ef71cba68 103 #endif
t_yamamoto 0:669ef71cba68 104 #if USE_PROCESS_NUM>5
t_yamamoto 0:669ef71cba68 105 static void Process5(void);
t_yamamoto 0:669ef71cba68 106 #endif
t_yamamoto 0:669ef71cba68 107 #if USE_PROCESS_NUM>6
t_yamamoto 0:669ef71cba68 108 static void Process6(void);
t_yamamoto 0:669ef71cba68 109 #endif
t_yamamoto 0:669ef71cba68 110 #if USE_PROCESS_NUM>7
t_yamamoto 0:669ef71cba68 111 static void Process7(void);
t_yamamoto 0:669ef71cba68 112 #endif
t_yamamoto 0:669ef71cba68 113 #if USE_PROCESS_NUM>8
t_yamamoto 0:669ef71cba68 114 static void Process8(void);
t_yamamoto 0:669ef71cba68 115 #endif
t_yamamoto 0:669ef71cba68 116 #if USE_PROCESS_NUM>9
t_yamamoto 0:669ef71cba68 117 static void Process9(void);
t_yamamoto 0:669ef71cba68 118 #endif
t_yamamoto 0:669ef71cba68 119 #endif
t_yamamoto 0:669ef71cba68 120
t_yamamoto 0:669ef71cba68 121 void SystemProcessInitialize()
t_yamamoto 0:669ef71cba68 122 {
t_yamamoto 0:669ef71cba68 123 #pragma region USER-DEFINED_VARIABLE_INIT
kishibekairohan 16:3f2c2d89372b 124 /*Replace here with the initialization code of your variables.*/
t_yamamoto 0:669ef71cba68 125 #pragma endregion USER-DEFINED_VARIABLE_INIT
t_yamamoto 0:669ef71cba68 126
t_yamamoto 0:669ef71cba68 127 lock = true;
t_yamamoto 0:669ef71cba68 128 processChangeComp = true;
t_yamamoto 0:669ef71cba68 129 current = DEFAULT_PROCESS;
t_yamamoto 0:669ef71cba68 130
t_yamamoto 0:669ef71cba68 131 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 132 #if USE_PROCESS_NUM>0
t_yamamoto 0:669ef71cba68 133 Process[0] = Process0;
t_yamamoto 0:669ef71cba68 134 #endif
t_yamamoto 0:669ef71cba68 135 #if USE_PROCESS_NUM>1
t_yamamoto 0:669ef71cba68 136 Process[1] = Process1;
t_yamamoto 0:669ef71cba68 137 #endif
t_yamamoto 0:669ef71cba68 138 #if USE_PROCESS_NUM>2
t_yamamoto 0:669ef71cba68 139 Process[2] = Process2;
t_yamamoto 0:669ef71cba68 140 #endif
t_yamamoto 0:669ef71cba68 141 #if USE_PROCESS_NUM>3
t_yamamoto 0:669ef71cba68 142 Process[3] = Process3;
t_yamamoto 0:669ef71cba68 143 #endif
t_yamamoto 0:669ef71cba68 144 #if USE_PROCESS_NUM>4
t_yamamoto 0:669ef71cba68 145 Process[4] = Process4;
t_yamamoto 0:669ef71cba68 146 #endif
t_yamamoto 0:669ef71cba68 147 #if USE_PROCESS_NUM>5
t_yamamoto 0:669ef71cba68 148 Process[5] = Process5;
t_yamamoto 0:669ef71cba68 149 #endif
t_yamamoto 0:669ef71cba68 150 #if USE_PROCESS_NUM>6
t_yamamoto 0:669ef71cba68 151 Process[6] = Process6;
t_yamamoto 0:669ef71cba68 152 #endif
t_yamamoto 0:669ef71cba68 153 #if USE_PROCESS_NUM>7
t_yamamoto 0:669ef71cba68 154 Process[7] = Process7;
t_yamamoto 0:669ef71cba68 155 #endif
t_yamamoto 0:669ef71cba68 156 #if USE_PROCESS_NUM>8
t_yamamoto 0:669ef71cba68 157 Process[8] = Process8;
t_yamamoto 0:669ef71cba68 158 #endif
t_yamamoto 0:669ef71cba68 159 #if USE_PROCESS_NUM>9
t_yamamoto 0:669ef71cba68 160 Process[9] = Process9;
t_yamamoto 0:669ef71cba68 161 #endif
t_yamamoto 0:669ef71cba68 162 #endif
t_yamamoto 0:669ef71cba68 163 }
t_yamamoto 0:669ef71cba68 164
t_yamamoto 0:669ef71cba68 165 static void SystemProcessUpdate()
t_yamamoto 0:669ef71cba68 166 {
t_yamamoto 0:669ef71cba68 167 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 168 if(controller->Button.HOME) lock = false;
t_yamamoto 0:669ef71cba68 169
t_yamamoto 0:669ef71cba68 170 if(controller->Button.START && processChangeComp)
t_yamamoto 0:669ef71cba68 171 {
t_yamamoto 0:669ef71cba68 172 current++;
t_yamamoto 0:669ef71cba68 173 if (USE_PROCESS_NUM < current) current = USE_PROCESS_NUM;
t_yamamoto 0:669ef71cba68 174 processChangeComp = false;
t_yamamoto 0:669ef71cba68 175 }
t_yamamoto 0:669ef71cba68 176 else if(controller->Button.SELECT && processChangeComp)
t_yamamoto 0:669ef71cba68 177 {
t_yamamoto 0:669ef71cba68 178 current--;
t_yamamoto 0:669ef71cba68 179 if (current < 0) current = 0;
t_yamamoto 0:669ef71cba68 180 processChangeComp = false;
t_yamamoto 0:669ef71cba68 181 }
t_yamamoto 0:669ef71cba68 182 else if(!controller->Button.SELECT && !controller->Button.START) processChangeComp = true;
t_yamamoto 0:669ef71cba68 183 #endif
t_yamamoto 0:669ef71cba68 184
t_yamamoto 0:669ef71cba68 185 #ifdef USE_MOTOR
t_yamamoto 0:669ef71cba68 186 ACTUATORHUB::MOTOR::Motor::Update(motor);
t_yamamoto 0:669ef71cba68 187 #endif
t_yamamoto 0:669ef71cba68 188
t_yamamoto 0:669ef71cba68 189 #ifdef USE_SOLENOID
t_yamamoto 0:669ef71cba68 190 ACTUATORHUB::SOLENOID::Solenoid::Update(solenoid);
t_yamamoto 0:669ef71cba68 191 #endif
t_yamamoto 0:669ef71cba68 192
t_yamamoto 0:669ef71cba68 193 #ifdef USE_RS485
t_yamamoto 0:669ef71cba68 194 ACTUATORHUB::ActuatorHub::Update();
t_yamamoto 0:669ef71cba68 195 #endif
t_yamamoto 0:669ef71cba68 196
t_yamamoto 0:669ef71cba68 197 }
t_yamamoto 0:669ef71cba68 198
kishibekairohan 2:c015739085d3 199
kishibekairohan 2:c015739085d3 200
t_yamamoto 0:669ef71cba68 201 void SystemProcess()
t_yamamoto 0:669ef71cba68 202 {
t_yamamoto 0:669ef71cba68 203 SystemProcessInitialize();
t_yamamoto 0:669ef71cba68 204
t_yamamoto 0:669ef71cba68 205 while(1)
kishibekairohan 15:dfcec98f5aa9 206 {
M_souta 20:eae8c84f318c 207
M_souta 20:eae8c84f318c 208 pc.printf("aaa\n\r");
M_souta 20:eae8c84f318c 209
M_souta 19:96a462583af9 210 if(LimitSw::IsPressed(10)) {
M_souta 19:96a462583af9 211 LED_DEBUG0 = LED_ON;
M_souta 19:96a462583af9 212 } else {
M_souta 19:96a462583af9 213 LED_DEBUG0 = LED_OFF;
M_souta 19:96a462583af9 214 }
kishibekairohan 16:3f2c2d89372b 215 //printf("%d\r\n",ECD_0.getPulses());
kishibekairohan 17:50dc4b449e69 216 buzzer.period(1.0/800);
kishibekairohan 15:dfcec98f5aa9 217
t_yamamoto 0:669ef71cba68 218 #ifdef USE_MU
t_yamamoto 0:669ef71cba68 219 controller = CONTROLLER::Controller::GetData();
t_yamamoto 0:669ef71cba68 220 #endif
t_yamamoto 0:669ef71cba68 221
t_yamamoto 0:669ef71cba68 222 #ifdef USE_ERRORCHECK
t_yamamoto 0:669ef71cba68 223 if(SAFTY::ErrorCheck::Check() & SAFTY::Error::ControllerLost)
t_yamamoto 0:669ef71cba68 224 {
t_yamamoto 0:669ef71cba68 225 CONTROLLER::Controller::DataReset();
t_yamamoto 0:669ef71cba68 226 AllActuatorReset();
t_yamamoto 0:669ef71cba68 227 lock = true;
t_yamamoto 0:669ef71cba68 228 }
t_yamamoto 0:669ef71cba68 229 else
t_yamamoto 0:669ef71cba68 230 #endif
t_yamamoto 0:669ef71cba68 231 {
t_yamamoto 0:669ef71cba68 232
t_yamamoto 0:669ef71cba68 233 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 234 if(!lock)
t_yamamoto 0:669ef71cba68 235 {
t_yamamoto 0:669ef71cba68 236 Process[current]();
t_yamamoto 0:669ef71cba68 237 }
t_yamamoto 0:669ef71cba68 238 else
t_yamamoto 0:669ef71cba68 239 #endif
t_yamamoto 0:669ef71cba68 240 {
t_yamamoto 0:669ef71cba68 241 //ロック時の処理
t_yamamoto 0:669ef71cba68 242 }
t_yamamoto 0:669ef71cba68 243 }
t_yamamoto 0:669ef71cba68 244
kishibekairohan 16:3f2c2d89372b 245 //Emergency!
kishibekairohan 17:50dc4b449e69 246 if(!EMG_0 && !EMG_1 && !EMGflag){
kishibekairohan 17:50dc4b449e69 247 buzzer = 0;
kishibekairohan 17:50dc4b449e69 248 BuzzerTimer.attach(BuzzerTimer_func, 1);
kishibekairohan 17:50dc4b449e69 249 EMGflag = true;
kishibekairohan 17:50dc4b449e69 250 LED_DEBUG0 = 1;
kishibekairohan 9:f93fc79a49ea 251 }
kishibekairohan 17:50dc4b449e69 252 if(EMG_0 && EMG_1 && EMGflag){
kishibekairohan 17:50dc4b449e69 253 buzzer = 1;
kishibekairohan 9:f93fc79a49ea 254 BuzzerTimer.detach();
kishibekairohan 17:50dc4b449e69 255 EMGflag = false;
kishibekairohan 9:f93fc79a49ea 256 }
t_yamamoto 0:669ef71cba68 257 SystemProcessUpdate();
t_yamamoto 0:669ef71cba68 258 }
t_yamamoto 0:669ef71cba68 259 }
t_yamamoto 0:669ef71cba68 260
kishibekairohan 2:c015739085d3 261
kishibekairohan 2:c015739085d3 262
kishibekairohan 2:c015739085d3 263
t_yamamoto 0:669ef71cba68 264 #pragma region PROCESS
t_yamamoto 0:669ef71cba68 265 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 266 #if USE_PROCESS_NUM>0
kishibekairohan 12:c09b3e08a316 267 static void Process0()
kishibekairohan 10:1295d39fec3a 268 {
kishibekairohan 16:3f2c2d89372b 269
t_yamamoto 0:669ef71cba68 270 }
t_yamamoto 0:669ef71cba68 271 #endif
t_yamamoto 0:669ef71cba68 272
t_yamamoto 0:669ef71cba68 273 #if USE_PROCESS_NUM>1
kishibekairohan 16:3f2c2d89372b 274 static void Process1()
t_yamamoto 0:669ef71cba68 275 {
7ka884 4:ba9df71868df 276
t_yamamoto 0:669ef71cba68 277 }
t_yamamoto 0:669ef71cba68 278 #endif
t_yamamoto 0:669ef71cba68 279
t_yamamoto 0:669ef71cba68 280 #if USE_PROCESS_NUM>2
kishibekairohan 16:3f2c2d89372b 281 static void Process2()
kishibekairohan 13:b6e02d6261d7 282 {
kishibekairohan 13:b6e02d6261d7 283
kishibekairohan 13:b6e02d6261d7 284 }
kishibekairohan 13:b6e02d6261d7 285 #endif
kishibekairohan 13:b6e02d6261d7 286
kishibekairohan 13:b6e02d6261d7 287 #if USE_PROCESS_NUM>3
kishibekairohan 16:3f2c2d89372b 288 static void Process3()
kishibekairohan 13:b6e02d6261d7 289 {
kishibekairohan 15:dfcec98f5aa9 290
kishibekairohan 13:b6e02d6261d7 291 }
kishibekairohan 13:b6e02d6261d7 292 #endif
kishibekairohan 13:b6e02d6261d7 293
kishibekairohan 13:b6e02d6261d7 294 #if USE_PROCESS_NUM>4
kishibekairohan 13:b6e02d6261d7 295 static void Process4()
kishibekairohan 12:c09b3e08a316 296 {
kishibekairohan 15:dfcec98f5aa9 297
kishibekairohan 13:b6e02d6261d7 298 }
kishibekairohan 13:b6e02d6261d7 299 #endif
kishibekairohan 13:b6e02d6261d7 300
kishibekairohan 13:b6e02d6261d7 301 #if USE_PROCESS_NUM>5
kishibekairohan 16:3f2c2d89372b 302 static void Process5()
kishibekairohan 16:3f2c2d89372b 303 {
kishibekairohan 13:b6e02d6261d7 304
kishibekairohan 13:b6e02d6261d7 305 }
kishibekairohan 13:b6e02d6261d7 306 #endif
kishibekairohan 13:b6e02d6261d7 307
kishibekairohan 13:b6e02d6261d7 308 #if USE_PROCESS_NUM>6
kishibekairohan 13:b6e02d6261d7 309 static void Process6()
kishibekairohan 13:b6e02d6261d7 310 {
kishibekairohan 13:b6e02d6261d7 311
kishibekairohan 13:b6e02d6261d7 312 }
kishibekairohan 13:b6e02d6261d7 313 #endif
kishibekairohan 13:b6e02d6261d7 314
kishibekairohan 13:b6e02d6261d7 315 #if USE_PROCESS_NUM>7
kishibekairohan 13:b6e02d6261d7 316 static void Process7()
kishibekairohan 13:b6e02d6261d7 317 {
kishibekairohan 12:c09b3e08a316 318
kishibekairohan 12:c09b3e08a316 319 }
kishibekairohan 12:c09b3e08a316 320 #endif
kishibekairohan 12:c09b3e08a316 321
kishibekairohan 16:3f2c2d89372b 322 #if USE_PROCESS_NUM>8
kishibekairohan 13:b6e02d6261d7 323 static void Process8()
kishibekairohan 12:c09b3e08a316 324 {
kishibekairohan 12:c09b3e08a316 325
kishibekairohan 12:c09b3e08a316 326 }
kishibekairohan 12:c09b3e08a316 327 #endif
kishibekairohan 12:c09b3e08a316 328
kishibekairohan 13:b6e02d6261d7 329 #if USE_PROCESS_NUM>9
kishibekairohan 13:b6e02d6261d7 330 static void Process9()
kishibekairohan 12:c09b3e08a316 331 {
kishibekairohan 2:c015739085d3 332
t_yamamoto 0:669ef71cba68 333 }
t_yamamoto 0:669ef71cba68 334 #endif
t_yamamoto 0:669ef71cba68 335 #endif
t_yamamoto 0:669ef71cba68 336 #pragma endregion PROCESS
t_yamamoto 0:669ef71cba68 337
t_yamamoto 0:669ef71cba68 338 static void AllActuatorReset()
t_yamamoto 0:669ef71cba68 339 {
t_yamamoto 0:669ef71cba68 340
t_yamamoto 0:669ef71cba68 341 #ifdef USE_SOLENOID
t_yamamoto 0:669ef71cba68 342 solenoid.all = ALL_SOLENOID_OFF;
t_yamamoto 0:669ef71cba68 343 #endif
t_yamamoto 0:669ef71cba68 344
t_yamamoto 0:669ef71cba68 345 #ifdef USE_MOTOR
t_yamamoto 0:669ef71cba68 346 for (uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++)
t_yamamoto 0:669ef71cba68 347 {
t_yamamoto 0:669ef71cba68 348 motor[i].dir = FREE;
t_yamamoto 0:669ef71cba68 349 motor[i].pwm = 0;
t_yamamoto 0:669ef71cba68 350 }
t_yamamoto 0:669ef71cba68 351 #endif
t_yamamoto 0:669ef71cba68 352 }
t_yamamoto 0:669ef71cba68 353
kishibekairohan 16:3f2c2d89372b 354 void BuzzerTimer_func(){
kishibekairohan 16:3f2c2d89372b 355 buzzer = !buzzer;
kishibekairohan 17:50dc4b449e69 356 //LED_DEBUG0 = !LED_DEBUG0;
kishibekairohan 11:028a150943b5 357 }
kishibekairohan 11:028a150943b5 358
kishibekairohan 11:028a150943b5 359 void TapeLedEms_func() {
kishibekairohan 16:3f2c2d89372b 360 sendLedData.code = sendLedData.code == (uint32_t)Red ? (uint32_t)Black : (uint32_t)Red;
kishibekairohan 9:f93fc79a49ea 361 }
kishibekairohan 16:3f2c2d89372b 362
kishibekairohan 16:3f2c2d89372b 363 #pragma region USER-DEFINED-FUNCTIONS
kishibekairohan 16:3f2c2d89372b 364
kishibekairohan 16:3f2c2d89372b 365
t_yamamoto 0:669ef71cba68 366 #pragma endregion