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