![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ttt
Dependencies: mbed TrapezoidControl QEI Pulse LM61CIZ
System/Process/Process.cpp@17:50dc4b449e69, 2019-07-06 (annotated)
- Committer:
- kishibekairohan
- Date:
- Sat Jul 06 07:58:17 2019 +0000
- Revision:
- 17:50dc4b449e69
- Parent:
- 16:3f2c2d89372b
- Child:
- 18:c694bae76e51
a;
Who changed what in which revision?
User | Revision | Line number | New 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 | |
t_yamamoto | 0:669ef71cba68 | 65 | #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE |
t_yamamoto | 0:669ef71cba68 | 66 | |
t_yamamoto | 0:669ef71cba68 | 67 | #ifdef USE_SUBPROCESS |
t_yamamoto | 0:669ef71cba68 | 68 | #if USE_PROCESS_NUM>0 |
t_yamamoto | 0:669ef71cba68 | 69 | static void Process0(void); |
t_yamamoto | 0:669ef71cba68 | 70 | #endif |
t_yamamoto | 0:669ef71cba68 | 71 | #if USE_PROCESS_NUM>1 |
t_yamamoto | 0:669ef71cba68 | 72 | static void Process1(void); |
t_yamamoto | 0:669ef71cba68 | 73 | #endif |
t_yamamoto | 0:669ef71cba68 | 74 | #if USE_PROCESS_NUM>2 |
t_yamamoto | 0:669ef71cba68 | 75 | static void Process2(void); |
t_yamamoto | 0:669ef71cba68 | 76 | #endif |
t_yamamoto | 0:669ef71cba68 | 77 | #if USE_PROCESS_NUM>3 |
t_yamamoto | 0:669ef71cba68 | 78 | static void Process3(void); |
t_yamamoto | 0:669ef71cba68 | 79 | #endif |
t_yamamoto | 0:669ef71cba68 | 80 | #if USE_PROCESS_NUM>4 |
t_yamamoto | 0:669ef71cba68 | 81 | static void Process4(void); |
t_yamamoto | 0:669ef71cba68 | 82 | #endif |
t_yamamoto | 0:669ef71cba68 | 83 | #if USE_PROCESS_NUM>5 |
t_yamamoto | 0:669ef71cba68 | 84 | static void Process5(void); |
t_yamamoto | 0:669ef71cba68 | 85 | #endif |
t_yamamoto | 0:669ef71cba68 | 86 | #if USE_PROCESS_NUM>6 |
t_yamamoto | 0:669ef71cba68 | 87 | static void Process6(void); |
t_yamamoto | 0:669ef71cba68 | 88 | #endif |
t_yamamoto | 0:669ef71cba68 | 89 | #if USE_PROCESS_NUM>7 |
t_yamamoto | 0:669ef71cba68 | 90 | static void Process7(void); |
t_yamamoto | 0:669ef71cba68 | 91 | #endif |
t_yamamoto | 0:669ef71cba68 | 92 | #if USE_PROCESS_NUM>8 |
t_yamamoto | 0:669ef71cba68 | 93 | static void Process8(void); |
t_yamamoto | 0:669ef71cba68 | 94 | #endif |
t_yamamoto | 0:669ef71cba68 | 95 | #if USE_PROCESS_NUM>9 |
t_yamamoto | 0:669ef71cba68 | 96 | static void Process9(void); |
t_yamamoto | 0:669ef71cba68 | 97 | #endif |
t_yamamoto | 0:669ef71cba68 | 98 | #endif |
t_yamamoto | 0:669ef71cba68 | 99 | |
t_yamamoto | 0:669ef71cba68 | 100 | void SystemProcessInitialize() |
t_yamamoto | 0:669ef71cba68 | 101 | { |
t_yamamoto | 0:669ef71cba68 | 102 | #pragma region USER-DEFINED_VARIABLE_INIT |
kishibekairohan | 16:3f2c2d89372b | 103 | /*Replace here with the initialization code of your variables.*/ |
t_yamamoto | 0:669ef71cba68 | 104 | #pragma endregion USER-DEFINED_VARIABLE_INIT |
t_yamamoto | 0:669ef71cba68 | 105 | |
t_yamamoto | 0:669ef71cba68 | 106 | lock = true; |
t_yamamoto | 0:669ef71cba68 | 107 | processChangeComp = true; |
t_yamamoto | 0:669ef71cba68 | 108 | current = DEFAULT_PROCESS; |
t_yamamoto | 0:669ef71cba68 | 109 | |
t_yamamoto | 0:669ef71cba68 | 110 | #ifdef USE_SUBPROCESS |
t_yamamoto | 0:669ef71cba68 | 111 | #if USE_PROCESS_NUM>0 |
t_yamamoto | 0:669ef71cba68 | 112 | Process[0] = Process0; |
t_yamamoto | 0:669ef71cba68 | 113 | #endif |
t_yamamoto | 0:669ef71cba68 | 114 | #if USE_PROCESS_NUM>1 |
t_yamamoto | 0:669ef71cba68 | 115 | Process[1] = Process1; |
t_yamamoto | 0:669ef71cba68 | 116 | #endif |
t_yamamoto | 0:669ef71cba68 | 117 | #if USE_PROCESS_NUM>2 |
t_yamamoto | 0:669ef71cba68 | 118 | Process[2] = Process2; |
t_yamamoto | 0:669ef71cba68 | 119 | #endif |
t_yamamoto | 0:669ef71cba68 | 120 | #if USE_PROCESS_NUM>3 |
t_yamamoto | 0:669ef71cba68 | 121 | Process[3] = Process3; |
t_yamamoto | 0:669ef71cba68 | 122 | #endif |
t_yamamoto | 0:669ef71cba68 | 123 | #if USE_PROCESS_NUM>4 |
t_yamamoto | 0:669ef71cba68 | 124 | Process[4] = Process4; |
t_yamamoto | 0:669ef71cba68 | 125 | #endif |
t_yamamoto | 0:669ef71cba68 | 126 | #if USE_PROCESS_NUM>5 |
t_yamamoto | 0:669ef71cba68 | 127 | Process[5] = Process5; |
t_yamamoto | 0:669ef71cba68 | 128 | #endif |
t_yamamoto | 0:669ef71cba68 | 129 | #if USE_PROCESS_NUM>6 |
t_yamamoto | 0:669ef71cba68 | 130 | Process[6] = Process6; |
t_yamamoto | 0:669ef71cba68 | 131 | #endif |
t_yamamoto | 0:669ef71cba68 | 132 | #if USE_PROCESS_NUM>7 |
t_yamamoto | 0:669ef71cba68 | 133 | Process[7] = Process7; |
t_yamamoto | 0:669ef71cba68 | 134 | #endif |
t_yamamoto | 0:669ef71cba68 | 135 | #if USE_PROCESS_NUM>8 |
t_yamamoto | 0:669ef71cba68 | 136 | Process[8] = Process8; |
t_yamamoto | 0:669ef71cba68 | 137 | #endif |
t_yamamoto | 0:669ef71cba68 | 138 | #if USE_PROCESS_NUM>9 |
t_yamamoto | 0:669ef71cba68 | 139 | Process[9] = Process9; |
t_yamamoto | 0:669ef71cba68 | 140 | #endif |
t_yamamoto | 0:669ef71cba68 | 141 | #endif |
t_yamamoto | 0:669ef71cba68 | 142 | } |
t_yamamoto | 0:669ef71cba68 | 143 | |
t_yamamoto | 0:669ef71cba68 | 144 | static void SystemProcessUpdate() |
t_yamamoto | 0:669ef71cba68 | 145 | { |
t_yamamoto | 0:669ef71cba68 | 146 | #ifdef USE_SUBPROCESS |
t_yamamoto | 0:669ef71cba68 | 147 | if(controller->Button.HOME) lock = false; |
t_yamamoto | 0:669ef71cba68 | 148 | |
t_yamamoto | 0:669ef71cba68 | 149 | if(controller->Button.START && processChangeComp) |
t_yamamoto | 0:669ef71cba68 | 150 | { |
t_yamamoto | 0:669ef71cba68 | 151 | current++; |
t_yamamoto | 0:669ef71cba68 | 152 | if (USE_PROCESS_NUM < current) current = USE_PROCESS_NUM; |
t_yamamoto | 0:669ef71cba68 | 153 | processChangeComp = false; |
t_yamamoto | 0:669ef71cba68 | 154 | } |
t_yamamoto | 0:669ef71cba68 | 155 | else if(controller->Button.SELECT && processChangeComp) |
t_yamamoto | 0:669ef71cba68 | 156 | { |
t_yamamoto | 0:669ef71cba68 | 157 | current--; |
t_yamamoto | 0:669ef71cba68 | 158 | if (current < 0) current = 0; |
t_yamamoto | 0:669ef71cba68 | 159 | processChangeComp = false; |
t_yamamoto | 0:669ef71cba68 | 160 | } |
t_yamamoto | 0:669ef71cba68 | 161 | else if(!controller->Button.SELECT && !controller->Button.START) processChangeComp = true; |
t_yamamoto | 0:669ef71cba68 | 162 | #endif |
t_yamamoto | 0:669ef71cba68 | 163 | |
t_yamamoto | 0:669ef71cba68 | 164 | #ifdef USE_MOTOR |
t_yamamoto | 0:669ef71cba68 | 165 | ACTUATORHUB::MOTOR::Motor::Update(motor); |
t_yamamoto | 0:669ef71cba68 | 166 | #endif |
t_yamamoto | 0:669ef71cba68 | 167 | |
t_yamamoto | 0:669ef71cba68 | 168 | #ifdef USE_SOLENOID |
t_yamamoto | 0:669ef71cba68 | 169 | ACTUATORHUB::SOLENOID::Solenoid::Update(solenoid); |
t_yamamoto | 0:669ef71cba68 | 170 | #endif |
t_yamamoto | 0:669ef71cba68 | 171 | |
t_yamamoto | 0:669ef71cba68 | 172 | #ifdef USE_RS485 |
t_yamamoto | 0:669ef71cba68 | 173 | ACTUATORHUB::ActuatorHub::Update(); |
t_yamamoto | 0:669ef71cba68 | 174 | #endif |
t_yamamoto | 0:669ef71cba68 | 175 | |
t_yamamoto | 0:669ef71cba68 | 176 | } |
t_yamamoto | 0:669ef71cba68 | 177 | |
kishibekairohan | 2:c015739085d3 | 178 | |
kishibekairohan | 2:c015739085d3 | 179 | |
t_yamamoto | 0:669ef71cba68 | 180 | void SystemProcess() |
t_yamamoto | 0:669ef71cba68 | 181 | { |
t_yamamoto | 0:669ef71cba68 | 182 | SystemProcessInitialize(); |
t_yamamoto | 0:669ef71cba68 | 183 | |
t_yamamoto | 0:669ef71cba68 | 184 | while(1) |
kishibekairohan | 15:dfcec98f5aa9 | 185 | { |
kishibekairohan | 16:3f2c2d89372b | 186 | //LED_DEBUG0 = !LED_DEBUG0; |
kishibekairohan | 16:3f2c2d89372b | 187 | //LED_DEBUG1 = !LED_DEBUG1; |
kishibekairohan | 16:3f2c2d89372b | 188 | //printf("%d\r\n",ECD_0.getPulses()); |
kishibekairohan | 17:50dc4b449e69 | 189 | buzzer.period(1.0/800); |
kishibekairohan | 15:dfcec98f5aa9 | 190 | |
t_yamamoto | 0:669ef71cba68 | 191 | #ifdef USE_MU |
t_yamamoto | 0:669ef71cba68 | 192 | controller = CONTROLLER::Controller::GetData(); |
t_yamamoto | 0:669ef71cba68 | 193 | #endif |
t_yamamoto | 0:669ef71cba68 | 194 | |
t_yamamoto | 0:669ef71cba68 | 195 | #ifdef USE_ERRORCHECK |
t_yamamoto | 0:669ef71cba68 | 196 | if(SAFTY::ErrorCheck::Check() & SAFTY::Error::ControllerLost) |
t_yamamoto | 0:669ef71cba68 | 197 | { |
t_yamamoto | 0:669ef71cba68 | 198 | CONTROLLER::Controller::DataReset(); |
t_yamamoto | 0:669ef71cba68 | 199 | AllActuatorReset(); |
t_yamamoto | 0:669ef71cba68 | 200 | lock = true; |
kishibekairohan | 17:50dc4b449e69 | 201 | //buzzer = 1; |
kishibekairohan | 17:50dc4b449e69 | 202 | //BuzzerTimer.attach(BuzzerTimer_func, 0.5); |
kishibekairohan | 17:50dc4b449e69 | 203 | //buzzer = 1; |
kishibekairohan | 17:50dc4b449e69 | 204 | //BuzzerTimer.attach(&BuzzerTimer_func, 1.2); |
kishibekairohan | 17:50dc4b449e69 | 205 | //BuzzerTimer.attach(BuzzerTimer_func, 1); |
t_yamamoto | 0:669ef71cba68 | 206 | } |
t_yamamoto | 0:669ef71cba68 | 207 | else |
t_yamamoto | 0:669ef71cba68 | 208 | #endif |
t_yamamoto | 0:669ef71cba68 | 209 | { |
t_yamamoto | 0:669ef71cba68 | 210 | |
t_yamamoto | 0:669ef71cba68 | 211 | #ifdef USE_SUBPROCESS |
t_yamamoto | 0:669ef71cba68 | 212 | if(!lock) |
t_yamamoto | 0:669ef71cba68 | 213 | { |
t_yamamoto | 0:669ef71cba68 | 214 | Process[current](); |
t_yamamoto | 0:669ef71cba68 | 215 | } |
t_yamamoto | 0:669ef71cba68 | 216 | else |
t_yamamoto | 0:669ef71cba68 | 217 | #endif |
t_yamamoto | 0:669ef71cba68 | 218 | { |
t_yamamoto | 0:669ef71cba68 | 219 | //ロック時の処理 |
t_yamamoto | 0:669ef71cba68 | 220 | } |
t_yamamoto | 0:669ef71cba68 | 221 | } |
t_yamamoto | 0:669ef71cba68 | 222 | |
kishibekairohan | 16:3f2c2d89372b | 223 | //Emergency! |
kishibekairohan | 17:50dc4b449e69 | 224 | if(!EMG_0 && !EMG_1 && !EMGflag){ |
kishibekairohan | 17:50dc4b449e69 | 225 | buzzer = 0; |
kishibekairohan | 17:50dc4b449e69 | 226 | BuzzerTimer.attach(BuzzerTimer_func, 1); |
kishibekairohan | 17:50dc4b449e69 | 227 | EMGflag = true; |
kishibekairohan | 17:50dc4b449e69 | 228 | LED_DEBUG0 = 1; |
kishibekairohan | 9:f93fc79a49ea | 229 | } |
kishibekairohan | 17:50dc4b449e69 | 230 | if(EMG_0 && EMG_1 && EMGflag){ |
kishibekairohan | 17:50dc4b449e69 | 231 | buzzer = 1; |
kishibekairohan | 9:f93fc79a49ea | 232 | BuzzerTimer.detach(); |
kishibekairohan | 17:50dc4b449e69 | 233 | EMGflag = false; |
kishibekairohan | 9:f93fc79a49ea | 234 | } |
t_yamamoto | 0:669ef71cba68 | 235 | SystemProcessUpdate(); |
t_yamamoto | 0:669ef71cba68 | 236 | } |
t_yamamoto | 0:669ef71cba68 | 237 | } |
t_yamamoto | 0:669ef71cba68 | 238 | |
kishibekairohan | 2:c015739085d3 | 239 | |
kishibekairohan | 2:c015739085d3 | 240 | |
kishibekairohan | 2:c015739085d3 | 241 | |
t_yamamoto | 0:669ef71cba68 | 242 | #pragma region PROCESS |
t_yamamoto | 0:669ef71cba68 | 243 | #ifdef USE_SUBPROCESS |
t_yamamoto | 0:669ef71cba68 | 244 | #if USE_PROCESS_NUM>0 |
kishibekairohan | 12:c09b3e08a316 | 245 | static void Process0() |
kishibekairohan | 10:1295d39fec3a | 246 | { |
kishibekairohan | 16:3f2c2d89372b | 247 | |
t_yamamoto | 0:669ef71cba68 | 248 | } |
t_yamamoto | 0:669ef71cba68 | 249 | #endif |
t_yamamoto | 0:669ef71cba68 | 250 | |
t_yamamoto | 0:669ef71cba68 | 251 | #if USE_PROCESS_NUM>1 |
kishibekairohan | 16:3f2c2d89372b | 252 | static void Process1() |
t_yamamoto | 0:669ef71cba68 | 253 | { |
7ka884 | 4:ba9df71868df | 254 | |
t_yamamoto | 0:669ef71cba68 | 255 | } |
t_yamamoto | 0:669ef71cba68 | 256 | #endif |
t_yamamoto | 0:669ef71cba68 | 257 | |
t_yamamoto | 0:669ef71cba68 | 258 | #if USE_PROCESS_NUM>2 |
kishibekairohan | 16:3f2c2d89372b | 259 | static void Process2() |
kishibekairohan | 13:b6e02d6261d7 | 260 | { |
kishibekairohan | 13:b6e02d6261d7 | 261 | |
kishibekairohan | 13:b6e02d6261d7 | 262 | } |
kishibekairohan | 13:b6e02d6261d7 | 263 | #endif |
kishibekairohan | 13:b6e02d6261d7 | 264 | |
kishibekairohan | 13:b6e02d6261d7 | 265 | #if USE_PROCESS_NUM>3 |
kishibekairohan | 16:3f2c2d89372b | 266 | static void Process3() |
kishibekairohan | 13:b6e02d6261d7 | 267 | { |
kishibekairohan | 15:dfcec98f5aa9 | 268 | |
kishibekairohan | 13:b6e02d6261d7 | 269 | } |
kishibekairohan | 13:b6e02d6261d7 | 270 | #endif |
kishibekairohan | 13:b6e02d6261d7 | 271 | |
kishibekairohan | 13:b6e02d6261d7 | 272 | #if USE_PROCESS_NUM>4 |
kishibekairohan | 13:b6e02d6261d7 | 273 | static void Process4() |
kishibekairohan | 12:c09b3e08a316 | 274 | { |
kishibekairohan | 15:dfcec98f5aa9 | 275 | |
kishibekairohan | 13:b6e02d6261d7 | 276 | } |
kishibekairohan | 13:b6e02d6261d7 | 277 | #endif |
kishibekairohan | 13:b6e02d6261d7 | 278 | |
kishibekairohan | 13:b6e02d6261d7 | 279 | #if USE_PROCESS_NUM>5 |
kishibekairohan | 16:3f2c2d89372b | 280 | static void Process5() |
kishibekairohan | 16:3f2c2d89372b | 281 | { |
kishibekairohan | 13:b6e02d6261d7 | 282 | |
kishibekairohan | 13:b6e02d6261d7 | 283 | } |
kishibekairohan | 13:b6e02d6261d7 | 284 | #endif |
kishibekairohan | 13:b6e02d6261d7 | 285 | |
kishibekairohan | 13:b6e02d6261d7 | 286 | #if USE_PROCESS_NUM>6 |
kishibekairohan | 13:b6e02d6261d7 | 287 | static void Process6() |
kishibekairohan | 13:b6e02d6261d7 | 288 | { |
kishibekairohan | 13:b6e02d6261d7 | 289 | |
kishibekairohan | 13:b6e02d6261d7 | 290 | } |
kishibekairohan | 13:b6e02d6261d7 | 291 | #endif |
kishibekairohan | 13:b6e02d6261d7 | 292 | |
kishibekairohan | 13:b6e02d6261d7 | 293 | #if USE_PROCESS_NUM>7 |
kishibekairohan | 13:b6e02d6261d7 | 294 | static void Process7() |
kishibekairohan | 13:b6e02d6261d7 | 295 | { |
kishibekairohan | 12:c09b3e08a316 | 296 | |
kishibekairohan | 12:c09b3e08a316 | 297 | } |
kishibekairohan | 12:c09b3e08a316 | 298 | #endif |
kishibekairohan | 12:c09b3e08a316 | 299 | |
kishibekairohan | 16:3f2c2d89372b | 300 | #if USE_PROCESS_NUM>8 |
kishibekairohan | 13:b6e02d6261d7 | 301 | static void Process8() |
kishibekairohan | 12:c09b3e08a316 | 302 | { |
kishibekairohan | 12:c09b3e08a316 | 303 | |
kishibekairohan | 12:c09b3e08a316 | 304 | } |
kishibekairohan | 12:c09b3e08a316 | 305 | #endif |
kishibekairohan | 12:c09b3e08a316 | 306 | |
kishibekairohan | 13:b6e02d6261d7 | 307 | #if USE_PROCESS_NUM>9 |
kishibekairohan | 13:b6e02d6261d7 | 308 | static void Process9() |
kishibekairohan | 12:c09b3e08a316 | 309 | { |
kishibekairohan | 2:c015739085d3 | 310 | |
t_yamamoto | 0:669ef71cba68 | 311 | } |
t_yamamoto | 0:669ef71cba68 | 312 | #endif |
t_yamamoto | 0:669ef71cba68 | 313 | #endif |
t_yamamoto | 0:669ef71cba68 | 314 | #pragma endregion PROCESS |
t_yamamoto | 0:669ef71cba68 | 315 | |
t_yamamoto | 0:669ef71cba68 | 316 | static void AllActuatorReset() |
t_yamamoto | 0:669ef71cba68 | 317 | { |
t_yamamoto | 0:669ef71cba68 | 318 | |
t_yamamoto | 0:669ef71cba68 | 319 | #ifdef USE_SOLENOID |
t_yamamoto | 0:669ef71cba68 | 320 | solenoid.all = ALL_SOLENOID_OFF; |
t_yamamoto | 0:669ef71cba68 | 321 | #endif |
t_yamamoto | 0:669ef71cba68 | 322 | |
t_yamamoto | 0:669ef71cba68 | 323 | #ifdef USE_MOTOR |
t_yamamoto | 0:669ef71cba68 | 324 | for (uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) |
t_yamamoto | 0:669ef71cba68 | 325 | { |
t_yamamoto | 0:669ef71cba68 | 326 | motor[i].dir = FREE; |
t_yamamoto | 0:669ef71cba68 | 327 | motor[i].pwm = 0; |
t_yamamoto | 0:669ef71cba68 | 328 | } |
t_yamamoto | 0:669ef71cba68 | 329 | #endif |
t_yamamoto | 0:669ef71cba68 | 330 | } |
t_yamamoto | 0:669ef71cba68 | 331 | |
kishibekairohan | 16:3f2c2d89372b | 332 | void BuzzerTimer_func(){ |
kishibekairohan | 16:3f2c2d89372b | 333 | buzzer = !buzzer; |
kishibekairohan | 17:50dc4b449e69 | 334 | //LED_DEBUG0 = !LED_DEBUG0; |
kishibekairohan | 11:028a150943b5 | 335 | } |
kishibekairohan | 11:028a150943b5 | 336 | |
kishibekairohan | 11:028a150943b5 | 337 | void TapeLedEms_func() { |
kishibekairohan | 16:3f2c2d89372b | 338 | sendLedData.code = sendLedData.code == (uint32_t)Red ? (uint32_t)Black : (uint32_t)Red; |
kishibekairohan | 9:f93fc79a49ea | 339 | } |
kishibekairohan | 16:3f2c2d89372b | 340 | |
kishibekairohan | 16:3f2c2d89372b | 341 | #pragma region USER-DEFINED-FUNCTIONS |
kishibekairohan | 16:3f2c2d89372b | 342 | |
kishibekairohan | 16:3f2c2d89372b | 343 | |
t_yamamoto | 0:669ef71cba68 | 344 | #pragma endregion |