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