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