daad

Dependencies:   mbed TrapezoidControl QEI

Committer:
yabahiro
Date:
Fri Sep 13 01:36:42 2019 +0000
Revision:
21:1f1e9c585da8
Parent:
19:96a462583af9
Child:
22:c47f29caded6
qqq

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"
yabahiro 21:1f1e9c585da8 8 #include "../../Communication/RS485/LineHub/LineHub.h"
t_yamamoto 0:669ef71cba68 9 #include "../../Communication/Controller/Controller.h"
t_yamamoto 0:669ef71cba68 10 #include "../../Input/ExternalInt/ExternalInt.h"
t_yamamoto 0:669ef71cba68 11 #include "../../Input/Switch/Switch.h"
t_yamamoto 0:669ef71cba68 12 #include "../../Input/Potentiometer/Potentiometer.h"
kishibekairohan 16:3f2c2d89372b 13 #include "../../Input/Encoder/Encoder.h"
t_yamamoto 0:669ef71cba68 14 #include "../../LED/LED.h"
t_yamamoto 0:669ef71cba68 15 #include "../../Safty/Safty.h"
t_yamamoto 0:669ef71cba68 16 #include "../Using.h"
t_yamamoto 0:669ef71cba68 17
t_yamamoto 0:669ef71cba68 18 using namespace SWITCH;
7ka884 4:ba9df71868df 19 using namespace PID_SPACE;
kishibekairohan 16:3f2c2d89372b 20 using namespace ENCODER;
yabahiro 21:1f1e9c585da8 21 using namespace LINEHUB;
t_yamamoto 0:669ef71cba68 22
t_yamamoto 0:669ef71cba68 23 static CONTROLLER::ControllerData *controller;
t_yamamoto 0:669ef71cba68 24 ACTUATORHUB::MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM];
t_yamamoto 0:669ef71cba68 25 ACTUATORHUB::SOLENOID::SolenoidStatus solenoid;
t_yamamoto 0:669ef71cba68 26
t_yamamoto 0:669ef71cba68 27 static bool lock;
t_yamamoto 0:669ef71cba68 28 static bool processChangeComp;
t_yamamoto 0:669ef71cba68 29 static int current;
t_yamamoto 0:669ef71cba68 30
t_yamamoto 0:669ef71cba68 31 static void AllActuatorReset();
t_yamamoto 0:669ef71cba68 32
t_yamamoto 0:669ef71cba68 33 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 34 static void (*Process[USE_PROCESS_NUM])(void);
t_yamamoto 0:669ef71cba68 35 #endif
t_yamamoto 0:669ef71cba68 36
t_yamamoto 0:669ef71cba68 37 #pragma region USER-DEFINED_VARIABLES_AND_PROTOTYPE
t_yamamoto 0:669ef71cba68 38
t_yamamoto 0:669ef71cba68 39 /*Replace here with the definition code of your variables.*/
t_yamamoto 0:669ef71cba68 40
kishibekairohan 2:c015739085d3 41 Serial pc(USBTX, USBRX);
kishibekairohan 2:c015739085d3 42
kishibekairohan 16:3f2c2d89372b 43 //**************Encoder***************
kishibekairohan 16:3f2c2d89372b 44 const int PerRev = 256;
kishibekairohan 16:3f2c2d89372b 45 QEI ECD_0(ECD_A_0,ECD_B_0,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 46 QEI ECD_1(ECD_A_1,ECD_B_1,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 47 QEI ECD_2(ECD_A_2,ECD_B_2,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 48 QEI ECD_3(ECD_A_3,ECD_B_3,NC,PerRev,QEI::X4_ENCODING);
kishibekairohan 16:3f2c2d89372b 49 //**************Encoder***************
kishibekairohan 7:e88c5d47a3be 50
kishibekairohan 16:3f2c2d89372b 51 //**************Buzzer****************
kishibekairohan 11:028a150943b5 52 //DigitalOut buzzer(BUZZER_PIN);
kishibekairohan 9:f93fc79a49ea 53 void BuzzerTimer_func();
kishibekairohan 9:f93fc79a49ea 54 Ticker BuzzerTimer;
kishibekairohan 16:3f2c2d89372b 55 bool EMGflag = false;
yabahiro 21:1f1e9c585da8 56 //PWMOut buzzer(BUZZER_PIN);
kishibekairohan 16:3f2c2d89372b 57 //**************Buzzer****************
kishibekairohan 11:028a150943b5 58
kishibekairohan 11:028a150943b5 59 //************TapeLed*****************
kishibekairohan 11:028a150943b5 60 void TapeLedEms_func();
kishibekairohan 11:028a150943b5 61 TapeLedData tapeLED;
kishibekairohan 11:028a150943b5 62 TapeLedData sendLedData;
kishibekairohan 11:028a150943b5 63 TapeLED_Mode ledMode = Normal;
kishibekairohan 11:028a150943b5 64 Ticker tapeLedTimer;
kishibekairohan 11:028a150943b5 65 //************TapaLed*****************
kishibekairohan 16:3f2c2d89372b 66
M_souta 18:c694bae76e51 67 float tireProRPM[4];
M_souta 18:c694bae76e51 68 float tireTarRPM[4];
yabahiro 21:1f1e9c585da8 69 float tirepwm[4];
yabahiro 21:1f1e9c585da8 70
yabahiro 21:1f1e9c585da8 71 const int omni[15][15] = {
yabahiro 21:1f1e9c585da8 72 { 0, 5, 21, 47, 83, 130, 187, 255, 255, 255, 255, 255, 255, 255, 255 },
yabahiro 21:1f1e9c585da8 73 { -5, 0, 5, 21, 47, 83, 130, 187, 193, 208, 234, 255, 255, 255, 255 },
yabahiro 21:1f1e9c585da8 74 { -21, -5, 0, 5, 21, 47, 83, 130, 135, 151, 177, 213, 255, 255, 255 },
yabahiro 21:1f1e9c585da8 75 { -47, -21, 5, 0, 5, 21, 47, 83, 88, 104, 130, 167, 213, 255, 255 },
yabahiro 21:1f1e9c585da8 76 { -83, -47, -21, 5, 0, 5, 21, 47, 52, 68, 94, 130, 177, 234, 255 },
yabahiro 21:1f1e9c585da8 77 { -130, -83, -47, -21, 5, 0, 5, 21, 26, 42, 68, 104, 151, 208, 255 },
yabahiro 21:1f1e9c585da8 78 { -187, -130, -83, -47, -21, -5, 0, 5, 10, 26, 52, 88, 135, 193, 255 },
yabahiro 21:1f1e9c585da8 79 { -255, -187, -130, -83, -47, -21, -5, 0, 5, 21, 47, 83, 130, 187, 255 },
yabahiro 21:1f1e9c585da8 80 { -255, -193, -135, -88, -52, -26, -10, -5, 0, 5, 21, 47, 83, 130, 187 },
yabahiro 21:1f1e9c585da8 81 { -255, -208, -151, -104, -68, -42, -26, -21, -5, 0, 5, 21, 47, 83, 130 },
yabahiro 21:1f1e9c585da8 82 { -255, -234, -177, -130, -94, -68, -52, -47, -21, -7, 0, 7, 21, 47, 83 },
yabahiro 21:1f1e9c585da8 83 { -255, -255, -213, -167, -130, -104, -88, -83, -47, -21, -5, 0, 5, 21, 47 },
yabahiro 21:1f1e9c585da8 84 { -255, -255, -255, -213, -177, -151, -135, -130, -83, -47, -21, -5, 0, 5, 21 },
yabahiro 21:1f1e9c585da8 85 { -255, -255, -255, -255, -234, -208, -193, -187, -130, -83, -47, -21, -5, 0, 5 },
yabahiro 21:1f1e9c585da8 86 { -255, -255, -255, -255, -255, -255, -255, -255, -187, -130, -83, -47, -21, -5, 0 }
yabahiro 21:1f1e9c585da8 87 };
yabahiro 21:1f1e9c585da8 88
yabahiro 21:1f1e9c585da8 89 const int curve[15] = { -152, -98, -54, -18, 0, 0, 0, 0, 0, 0, 0, 18, 54, 98, 152 };
yabahiro 21:1f1e9c585da8 90 //{-200,-146,-102,-66,-36,-16,0,0,0,16,36,66,102,146,200}
yabahiro 21:1f1e9c585da8 91
yabahiro 21:1f1e9c585da8 92 uint8_t SetStatus(int);
yabahiro 21:1f1e9c585da8 93 uint8_t SetStatus(int pwmVal)
yabahiro 21:1f1e9c585da8 94 {
yabahiro 21:1f1e9c585da8 95 if (pwmVal < 0) return BACK;
yabahiro 21:1f1e9c585da8 96 else if (pwmVal > 0) return FOR;
yabahiro 21:1f1e9c585da8 97 else if (pwmVal == 0) return BRAKE;
yabahiro 21:1f1e9c585da8 98 else return BRAKE;
yabahiro 21:1f1e9c585da8 99 }
yabahiro 21:1f1e9c585da8 100 uint8_t Setpwm(int);
yabahiro 21:1f1e9c585da8 101 uint8_t Setpwm(int pwmVal)
yabahiro 21:1f1e9c585da8 102 {
yabahiro 21:1f1e9c585da8 103 if (pwmVal == 0 || pwmVal > 255 || pwmVal < -255) return 255;
yabahiro 21:1f1e9c585da8 104 else return abs(pwmVal);
yabahiro 21:1f1e9c585da8 105 }
M_souta 18:c694bae76e51 106
t_yamamoto 0:669ef71cba68 107 #pragma endregion USER-DEFINED_VARIABLES_AND_PROTOTYPE
t_yamamoto 0:669ef71cba68 108
t_yamamoto 0:669ef71cba68 109 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 110 #if USE_PROCESS_NUM>0
t_yamamoto 0:669ef71cba68 111 static void Process0(void);
t_yamamoto 0:669ef71cba68 112 #endif
t_yamamoto 0:669ef71cba68 113 #if USE_PROCESS_NUM>1
t_yamamoto 0:669ef71cba68 114 static void Process1(void);
t_yamamoto 0:669ef71cba68 115 #endif
t_yamamoto 0:669ef71cba68 116 #if USE_PROCESS_NUM>2
t_yamamoto 0:669ef71cba68 117 static void Process2(void);
t_yamamoto 0:669ef71cba68 118 #endif
t_yamamoto 0:669ef71cba68 119 #if USE_PROCESS_NUM>3
t_yamamoto 0:669ef71cba68 120 static void Process3(void);
t_yamamoto 0:669ef71cba68 121 #endif
t_yamamoto 0:669ef71cba68 122 #if USE_PROCESS_NUM>4
t_yamamoto 0:669ef71cba68 123 static void Process4(void);
t_yamamoto 0:669ef71cba68 124 #endif
t_yamamoto 0:669ef71cba68 125 #if USE_PROCESS_NUM>5
t_yamamoto 0:669ef71cba68 126 static void Process5(void);
t_yamamoto 0:669ef71cba68 127 #endif
t_yamamoto 0:669ef71cba68 128 #if USE_PROCESS_NUM>6
t_yamamoto 0:669ef71cba68 129 static void Process6(void);
t_yamamoto 0:669ef71cba68 130 #endif
t_yamamoto 0:669ef71cba68 131 #if USE_PROCESS_NUM>7
t_yamamoto 0:669ef71cba68 132 static void Process7(void);
t_yamamoto 0:669ef71cba68 133 #endif
t_yamamoto 0:669ef71cba68 134 #if USE_PROCESS_NUM>8
t_yamamoto 0:669ef71cba68 135 static void Process8(void);
t_yamamoto 0:669ef71cba68 136 #endif
t_yamamoto 0:669ef71cba68 137 #if USE_PROCESS_NUM>9
t_yamamoto 0:669ef71cba68 138 static void Process9(void);
t_yamamoto 0:669ef71cba68 139 #endif
t_yamamoto 0:669ef71cba68 140 #endif
t_yamamoto 0:669ef71cba68 141
t_yamamoto 0:669ef71cba68 142 void SystemProcessInitialize()
t_yamamoto 0:669ef71cba68 143 {
yabahiro 21:1f1e9c585da8 144 #pragma region USER-DEFINED_VARIABLE_INIT
yabahiro 21:1f1e9c585da8 145 /*Replace here with the initialization code of your variables.*/
yabahiro 21:1f1e9c585da8 146 #pragma endregion USER-DEFINED_VARIABLE_INIT
t_yamamoto 0:669ef71cba68 147
yabahiro 21:1f1e9c585da8 148 lock = true;
yabahiro 21:1f1e9c585da8 149 processChangeComp = true;
yabahiro 21:1f1e9c585da8 150 current = DEFAULT_PROCESS;
t_yamamoto 0:669ef71cba68 151
yabahiro 21:1f1e9c585da8 152 #ifdef USE_SUBPROCESS
yabahiro 21:1f1e9c585da8 153 #if USE_PROCESS_NUM>0
yabahiro 21:1f1e9c585da8 154 Process[0] = Process0;
yabahiro 21:1f1e9c585da8 155 #endif
yabahiro 21:1f1e9c585da8 156 #if USE_PROCESS_NUM>1
yabahiro 21:1f1e9c585da8 157 Process[1] = Process1;
yabahiro 21:1f1e9c585da8 158 #endif
yabahiro 21:1f1e9c585da8 159 #if USE_PROCESS_NUM>2
yabahiro 21:1f1e9c585da8 160 Process[2] = Process2;
yabahiro 21:1f1e9c585da8 161 #endif
yabahiro 21:1f1e9c585da8 162 #if USE_PROCESS_NUM>3
yabahiro 21:1f1e9c585da8 163 Process[3] = Process3;
yabahiro 21:1f1e9c585da8 164 #endif
yabahiro 21:1f1e9c585da8 165 #if USE_PROCESS_NUM>4
yabahiro 21:1f1e9c585da8 166 Process[4] = Process4;
yabahiro 21:1f1e9c585da8 167 #endif
yabahiro 21:1f1e9c585da8 168 #if USE_PROCESS_NUM>5
yabahiro 21:1f1e9c585da8 169 Process[5] = Process5;
yabahiro 21:1f1e9c585da8 170 #endif
yabahiro 21:1f1e9c585da8 171 #if USE_PROCESS_NUM>6
yabahiro 21:1f1e9c585da8 172 Process[6] = Process6;
yabahiro 21:1f1e9c585da8 173 #endif
yabahiro 21:1f1e9c585da8 174 #if USE_PROCESS_NUM>7
yabahiro 21:1f1e9c585da8 175 Process[7] = Process7;
yabahiro 21:1f1e9c585da8 176 #endif
yabahiro 21:1f1e9c585da8 177 #if USE_PROCESS_NUM>8
yabahiro 21:1f1e9c585da8 178 Process[8] = Process8;
yabahiro 21:1f1e9c585da8 179 #endif
yabahiro 21:1f1e9c585da8 180 #if USE_PROCESS_NUM>9
yabahiro 21:1f1e9c585da8 181 Process[9] = Process9;
yabahiro 21:1f1e9c585da8 182 #endif
yabahiro 21:1f1e9c585da8 183 #endif
t_yamamoto 0:669ef71cba68 184 }
t_yamamoto 0:669ef71cba68 185
t_yamamoto 0:669ef71cba68 186 static void SystemProcessUpdate()
t_yamamoto 0:669ef71cba68 187 {
yabahiro 21:1f1e9c585da8 188 #ifdef USE_SUBPROCESS
yabahiro 21:1f1e9c585da8 189 if(controller->Button.HOME) lock = false;
yabahiro 21:1f1e9c585da8 190
yabahiro 21:1f1e9c585da8 191 if(controller->Button.START && processChangeComp) {
yabahiro 21:1f1e9c585da8 192 current++;
yabahiro 21:1f1e9c585da8 193 if (USE_PROCESS_NUM < current) current = USE_PROCESS_NUM;
yabahiro 21:1f1e9c585da8 194 processChangeComp = false;
yabahiro 21:1f1e9c585da8 195 } else if(controller->Button.SELECT && processChangeComp) {
yabahiro 21:1f1e9c585da8 196 current--;
yabahiro 21:1f1e9c585da8 197 if (current < 0) current = 0;
yabahiro 21:1f1e9c585da8 198 processChangeComp = false;
yabahiro 21:1f1e9c585da8 199 } else if(!controller->Button.SELECT && !controller->Button.START) processChangeComp = true;
yabahiro 21:1f1e9c585da8 200 #endif
yabahiro 21:1f1e9c585da8 201
yabahiro 21:1f1e9c585da8 202 #ifdef USE_MOTOR
yabahiro 21:1f1e9c585da8 203 ACTUATORHUB::MOTOR::Motor::Update(motor);
yabahiro 21:1f1e9c585da8 204 #endif
yabahiro 21:1f1e9c585da8 205
yabahiro 21:1f1e9c585da8 206 #ifdef USE_SOLENOID
yabahiro 21:1f1e9c585da8 207 ACTUATORHUB::SOLENOID::Solenoid::Update(solenoid);
yabahiro 21:1f1e9c585da8 208 #endif
yabahiro 21:1f1e9c585da8 209
yabahiro 21:1f1e9c585da8 210 #ifdef USE_RS485
yabahiro 21:1f1e9c585da8 211 ACTUATORHUB::ActuatorHub::Update();
yabahiro 21:1f1e9c585da8 212 #endif
yabahiro 21:1f1e9c585da8 213
yabahiro 21:1f1e9c585da8 214 }
yabahiro 21:1f1e9c585da8 215
yabahiro 21:1f1e9c585da8 216 int g[8];
yabahiro 21:1f1e9c585da8 217
yabahiro 21:1f1e9c585da8 218 void SystemProcess()
yabahiro 21:1f1e9c585da8 219 {
yabahiro 21:1f1e9c585da8 220 SystemProcessInitialize();
yabahiro 21:1f1e9c585da8 221
yabahiro 21:1f1e9c585da8 222 while(1) {
yabahiro 21:1f1e9c585da8 223 for(int i = 0; i < 8; i++) {
yabahiro 21:1f1e9c585da8 224 g[i] = LineHub::GetPara(i);
yabahiro 21:1f1e9c585da8 225 }
t_yamamoto 0:669ef71cba68 226
yabahiro 21:1f1e9c585da8 227 #ifdef USE_MU
yabahiro 21:1f1e9c585da8 228 controller = CONTROLLER::Controller::GetData();
yabahiro 21:1f1e9c585da8 229 #endif
yabahiro 21:1f1e9c585da8 230
yabahiro 21:1f1e9c585da8 231 #ifdef USE_ERRORCHECK
yabahiro 21:1f1e9c585da8 232 if(SAFTY::ErrorCheck::Check() & SAFTY::Error::ControllerLost) {
yabahiro 21:1f1e9c585da8 233 CONTROLLER::Controller::DataReset();
yabahiro 21:1f1e9c585da8 234 AllActuatorReset();
yabahiro 21:1f1e9c585da8 235 lock = true;
yabahiro 21:1f1e9c585da8 236 } else
yabahiro 21:1f1e9c585da8 237 #endif
yabahiro 21:1f1e9c585da8 238 {
yabahiro 21:1f1e9c585da8 239
yabahiro 21:1f1e9c585da8 240 #ifdef USE_SUBPROCESS
yabahiro 21:1f1e9c585da8 241 if(!lock) {
yabahiro 21:1f1e9c585da8 242 Process[current]();
yabahiro 21:1f1e9c585da8 243 } else
yabahiro 21:1f1e9c585da8 244 #endif
yabahiro 21:1f1e9c585da8 245 {
yabahiro 21:1f1e9c585da8 246 //ロック時の処理
yabahiro 21:1f1e9c585da8 247 }
yabahiro 21:1f1e9c585da8 248 }
yabahiro 21:1f1e9c585da8 249 /*
yabahiro 21:1f1e9c585da8 250 //Emergency!
yabahiro 21:1f1e9c585da8 251 if(!EMG_0 && !EMG_1 && !EMGflag) {
yabahiro 21:1f1e9c585da8 252 buzzer = 0;
yabahiro 21:1f1e9c585da8 253 BuzzerTimer.attach(BuzzerTimer_func, 1);
yabahiro 21:1f1e9c585da8 254 EMGflag = true;
yabahiro 21:1f1e9c585da8 255 LED_DEBUG0 = 1;
yabahiro 21:1f1e9c585da8 256 }
yabahiro 21:1f1e9c585da8 257 if(EMG_0 && EMG_1 && EMGflag) {
yabahiro 21:1f1e9c585da8 258 buzzer = 1;
yabahiro 21:1f1e9c585da8 259 BuzzerTimer.detach();
yabahiro 21:1f1e9c585da8 260 EMGflag = false;
yabahiro 21:1f1e9c585da8 261 }
yabahiro 21:1f1e9c585da8 262 */
yabahiro 21:1f1e9c585da8 263 SystemProcessUpdate();
yabahiro 21:1f1e9c585da8 264 }
t_yamamoto 0:669ef71cba68 265 }
t_yamamoto 0:669ef71cba68 266
kishibekairohan 2:c015739085d3 267
kishibekairohan 2:c015739085d3 268
kishibekairohan 2:c015739085d3 269
t_yamamoto 0:669ef71cba68 270 #pragma region PROCESS
t_yamamoto 0:669ef71cba68 271 #ifdef USE_SUBPROCESS
t_yamamoto 0:669ef71cba68 272 #if USE_PROCESS_NUM>0
yabahiro 21:1f1e9c585da8 273 static void Process0()
yabahiro 21:1f1e9c585da8 274 {
yabahiro 21:1f1e9c585da8 275
t_yamamoto 0:669ef71cba68 276 }
t_yamamoto 0:669ef71cba68 277 #endif
t_yamamoto 0:669ef71cba68 278
t_yamamoto 0:669ef71cba68 279 #if USE_PROCESS_NUM>1
yabahiro 21:1f1e9c585da8 280
yabahiro 21:1f1e9c585da8 281
yabahiro 21:1f1e9c585da8 282 bool dz1=true;
yabahiro 21:1f1e9c585da8 283 bool dz1i=false;
yabahiro 21:1f1e9c585da8 284 bool dz2=true;
yabahiro 21:1f1e9c585da8 285 bool dz2i=false;
yabahiro 21:1f1e9c585da8 286 bool dz3=true;
yabahiro 21:1f1e9c585da8 287 bool dz3i=false;
yabahiro 21:1f1e9c585da8 288 bool dz4=true;
yabahiro 21:1f1e9c585da8 289 bool dz4i=false;
yabahiro 21:1f1e9c585da8 290
yabahiro 21:1f1e9c585da8 291 int mode=0;
yabahiro 21:1f1e9c585da8 292 int mode1=0;
yabahiro 21:1f1e9c585da8 293 int mode1g0=100000;
yabahiro 21:1f1e9c585da8 294
kishibekairohan 16:3f2c2d89372b 295 static void Process1()
t_yamamoto 0:669ef71cba68 296 {
yabahiro 21:1f1e9c585da8 297 mode1g0=100000;
yabahiro 21:1f1e9c585da8 298 mode=0;
yabahiro 21:1f1e9c585da8 299 mode1=0;
yabahiro 21:1f1e9c585da8 300 motor[TIRE_FR].dir = SetStatus(-omni[controller->AnalogL.Y][14-controller->AnalogL.X] + curve[controller->AnalogR.X]);
yabahiro 21:1f1e9c585da8 301 motor[TIRE_FL].dir = SetStatus(omni[controller->AnalogL.Y][controller->AnalogL.X] + curve[controller->AnalogR.X]);
yabahiro 21:1f1e9c585da8 302 motor[TIRE_BR].dir = SetStatus(-omni[14-controller->AnalogL.X][14-controller->AnalogL.Y] + curve[controller->AnalogR.X]);
yabahiro 21:1f1e9c585da8 303 motor[TIRE_BL].dir = SetStatus(omni[controller->AnalogL.X][14-controller->AnalogL.Y] + curve[controller->AnalogR.X]);
yabahiro 21:1f1e9c585da8 304
yabahiro 21:1f1e9c585da8 305 motor[TIRE_FR].pwm = Setpwm(omni[controller->AnalogL.Y][14-controller->AnalogL.X]+ curve[controller->AnalogR.X])*0.2;
yabahiro 21:1f1e9c585da8 306 motor[TIRE_FL].pwm = Setpwm(omni[controller->AnalogL.Y][controller->AnalogL.X]+ curve[controller->AnalogR.X])*0.2;
yabahiro 21:1f1e9c585da8 307 motor[TIRE_BR].pwm = Setpwm(omni[14-controller->AnalogL.X][14-controller->AnalogL.Y]+ curve[controller->AnalogR.X])*0.2;
yabahiro 21:1f1e9c585da8 308 motor[TIRE_BL].pwm = Setpwm(omni[controller->AnalogL.X][14-controller->AnalogL.Y]+ curve[controller->AnalogR.X])*0.2;
yabahiro 21:1f1e9c585da8 309
yabahiro 21:1f1e9c585da8 310 if(controller->Button.UP||controller->Button.DOWN) {
yabahiro 21:1f1e9c585da8 311
yabahiro 21:1f1e9c585da8 312 if(controller->Button.UP) {
yabahiro 21:1f1e9c585da8 313 motor[MOTOR_0].pwm = 110;
yabahiro 21:1f1e9c585da8 314 motor[MOTOR_0].dir = FOR;
yabahiro 21:1f1e9c585da8 315 }
yabahiro 21:1f1e9c585da8 316 if(controller->Button.DOWN) {
yabahiro 21:1f1e9c585da8 317 motor[MOTOR_0].pwm = 50;
yabahiro 21:1f1e9c585da8 318 motor[MOTOR_0].dir = BACK;
yabahiro 21:1f1e9c585da8 319 }
yabahiro 21:1f1e9c585da8 320 } else {
yabahiro 21:1f1e9c585da8 321 motor[MOTOR_0].pwm = 0;
yabahiro 21:1f1e9c585da8 322 motor[MOTOR_0].dir = BRAKE;
yabahiro 21:1f1e9c585da8 323 }
yabahiro 21:1f1e9c585da8 324 if(controller->Button.X) {
yabahiro 21:1f1e9c585da8 325 if(dz1==true) {
yabahiro 21:1f1e9c585da8 326 if(dz1i==false) {
yabahiro 21:1f1e9c585da8 327 solenoid.solenoid1 = SOLENOID_ON;
yabahiro 21:1f1e9c585da8 328 dz1i=true;
yabahiro 21:1f1e9c585da8 329 } else {
yabahiro 21:1f1e9c585da8 330 solenoid.solenoid1 = SOLENOID_OFF;
yabahiro 21:1f1e9c585da8 331 dz1i=false;
yabahiro 21:1f1e9c585da8 332 }
yabahiro 21:1f1e9c585da8 333 dz1=false;
yabahiro 21:1f1e9c585da8 334 }
yabahiro 21:1f1e9c585da8 335 } else {
yabahiro 21:1f1e9c585da8 336 dz1=true;
yabahiro 21:1f1e9c585da8 337 }
yabahiro 21:1f1e9c585da8 338
yabahiro 21:1f1e9c585da8 339 if(controller->Button.Y) {
yabahiro 21:1f1e9c585da8 340 if(dz2==true) {
yabahiro 21:1f1e9c585da8 341 if(dz2i==false) {
yabahiro 21:1f1e9c585da8 342 solenoid.solenoid2 = SOLENOID_ON;
yabahiro 21:1f1e9c585da8 343 dz2i=true;
yabahiro 21:1f1e9c585da8 344 } else {
yabahiro 21:1f1e9c585da8 345 solenoid.solenoid2 = SOLENOID_OFF;
yabahiro 21:1f1e9c585da8 346 dz2i=false;
yabahiro 21:1f1e9c585da8 347 }
yabahiro 21:1f1e9c585da8 348 dz2=false;
yabahiro 21:1f1e9c585da8 349 }
yabahiro 21:1f1e9c585da8 350 } else {
yabahiro 21:1f1e9c585da8 351 dz2=true;
yabahiro 21:1f1e9c585da8 352 }
yabahiro 21:1f1e9c585da8 353
yabahiro 21:1f1e9c585da8 354 if(controller->Button.A) {
yabahiro 21:1f1e9c585da8 355 if(dz3==true) {
yabahiro 21:1f1e9c585da8 356 if(dz3i==false) {
yabahiro 21:1f1e9c585da8 357 solenoid.solenoid3 = SOLENOID_ON;
yabahiro 21:1f1e9c585da8 358 dz3i=true;
yabahiro 21:1f1e9c585da8 359 } else {
yabahiro 21:1f1e9c585da8 360 solenoid.solenoid3 = SOLENOID_OFF;
yabahiro 21:1f1e9c585da8 361 dz3i=false;
yabahiro 21:1f1e9c585da8 362 }
yabahiro 21:1f1e9c585da8 363 dz3=false;
yabahiro 21:1f1e9c585da8 364 }
yabahiro 21:1f1e9c585da8 365 } else {
yabahiro 21:1f1e9c585da8 366 dz3=true;
yabahiro 21:1f1e9c585da8 367 }
yabahiro 21:1f1e9c585da8 368
yabahiro 21:1f1e9c585da8 369 if(controller->Button.B) {
yabahiro 21:1f1e9c585da8 370 if(dz4==true) {
yabahiro 21:1f1e9c585da8 371 if(dz4i==false) {
yabahiro 21:1f1e9c585da8 372 solenoid.solenoid4 = SOLENOID_ON;
yabahiro 21:1f1e9c585da8 373 dz4i=true;
yabahiro 21:1f1e9c585da8 374 } else {
yabahiro 21:1f1e9c585da8 375 solenoid.solenoid4 = SOLENOID_OFF;
yabahiro 21:1f1e9c585da8 376 dz4i=false;
yabahiro 21:1f1e9c585da8 377 }
yabahiro 21:1f1e9c585da8 378 dz4=false;
yabahiro 21:1f1e9c585da8 379 }
yabahiro 21:1f1e9c585da8 380 } else {
yabahiro 21:1f1e9c585da8 381 dz4=true;
yabahiro 21:1f1e9c585da8 382 }
yabahiro 21:1f1e9c585da8 383 /*
yabahiro 21:1f1e9c585da8 384 if(controller->Button.RIGHT){
yabahiro 21:1f1e9c585da8 385 motor[MOTOR_1].dir = FOR;
yabahiro 21:1f1e9c585da8 386 motor[MOTOR_1].pwm = 60;
yabahiro 21:1f1e9c585da8 387 if (ARM_1){
yabahiro 21:1f1e9c585da8 388 motor[MOTOR_1].dir = BRAKE;
yabahiro 21:1f1e9c585da8 389 }
yabahiro 21:1f1e9c585da8 390 }
yabahiro 21:1f1e9c585da8 391 else if(controller->Button.LEFT){
yabahiro 21:1f1e9c585da8 392 motor[MOTOR_1].dir = BACK;
yabahiro 21:1f1e9c585da8 393 motor[MOTOR_1].pwm = 60;
yabahiro 21:1f1e9c585da8 394 if (ARM_0){
yabahiro 21:1f1e9c585da8 395 motor[MOTOR_1].dir = BRAKE;
yabahiro 21:1f1e9c585da8 396 }
yabahiro 21:1f1e9c585da8 397 }
yabahiro 21:1f1e9c585da8 398 */
t_yamamoto 0:669ef71cba68 399 }
t_yamamoto 0:669ef71cba68 400 #endif
t_yamamoto 0:669ef71cba68 401
t_yamamoto 0:669ef71cba68 402 #if USE_PROCESS_NUM>2
yabahiro 21:1f1e9c585da8 403 bool mtc=false;
yabahiro 21:1f1e9c585da8 404
kishibekairohan 16:3f2c2d89372b 405 static void Process2()
yabahiro 21:1f1e9c585da8 406 {
yabahiro 21:1f1e9c585da8 407 // printf("1:%d 2:%d 3:%d 4:%d 5:%d 6:%d 7:%d 8:%d\n\r",g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7]);
yabahiro 21:1f1e9c585da8 408 mode1g0++;
yabahiro 21:1f1e9c585da8 409 if(g[0]!=99&&mode==0) {
yabahiro 21:1f1e9c585da8 410 switch(g[0]) {
yabahiro 21:1f1e9c585da8 411 case 98:
yabahiro 21:1f1e9c585da8 412 motor[TIRE_FR].pwm = 30;
yabahiro 21:1f1e9c585da8 413 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 414 motor[TIRE_FL].pwm = 30;
yabahiro 21:1f1e9c585da8 415 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 416 motor[TIRE_BR].pwm = 30;
yabahiro 21:1f1e9c585da8 417 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 418 motor[TIRE_BL].pwm = 30;
yabahiro 21:1f1e9c585da8 419 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 420 if(mode1g0>100000) {
yabahiro 21:1f1e9c585da8 421 mode1++;
yabahiro 21:1f1e9c585da8 422 mode1g0=0;
yabahiro 21:1f1e9c585da8 423 }
yabahiro 21:1f1e9c585da8 424 mtc=true;
yabahiro 21:1f1e9c585da8 425 if(mode1==2) {
yabahiro 21:1f1e9c585da8 426 mode=1;
yabahiro 21:1f1e9c585da8 427 }
yabahiro 21:1f1e9c585da8 428 break;
yabahiro 21:1f1e9c585da8 429 case 0:
yabahiro 21:1f1e9c585da8 430 motor[TIRE_FR].pwm = 60;
yabahiro 21:1f1e9c585da8 431 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 432 motor[TIRE_FL].pwm = 60;
yabahiro 21:1f1e9c585da8 433 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 434 motor[TIRE_BR].pwm = 60;
yabahiro 21:1f1e9c585da8 435 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 436 motor[TIRE_BL].pwm = 60;
yabahiro 21:1f1e9c585da8 437 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 438 mtc=true;
yabahiro 21:1f1e9c585da8 439 break;
yabahiro 21:1f1e9c585da8 440 case 255:
yabahiro 21:1f1e9c585da8 441 motor[TIRE_FR].pwm = 60;
yabahiro 21:1f1e9c585da8 442 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 443 motor[TIRE_FL].pwm = 40;
yabahiro 21:1f1e9c585da8 444 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 445 motor[TIRE_BR].pwm = 40;
yabahiro 21:1f1e9c585da8 446 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 447 motor[TIRE_BL].pwm = 60;
yabahiro 21:1f1e9c585da8 448 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 449 mtc=true;
yabahiro 21:1f1e9c585da8 450 break;
yabahiro 21:1f1e9c585da8 451 case 253:
yabahiro 21:1f1e9c585da8 452 motor[TIRE_FR].pwm = 20;
yabahiro 21:1f1e9c585da8 453 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 454 motor[TIRE_FL].pwm = 0;
yabahiro 21:1f1e9c585da8 455 motor[TIRE_FL].dir = FREE;
yabahiro 21:1f1e9c585da8 456 motor[TIRE_BR].pwm = 0;
yabahiro 21:1f1e9c585da8 457 motor[TIRE_BR].dir = FREE;
yabahiro 21:1f1e9c585da8 458 motor[TIRE_BL].pwm = 20;
yabahiro 21:1f1e9c585da8 459 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 460 mtc=true;
yabahiro 21:1f1e9c585da8 461 break;
yabahiro 21:1f1e9c585da8 462 case 254:
yabahiro 21:1f1e9c585da8 463 motor[TIRE_FR].pwm = 30;
yabahiro 21:1f1e9c585da8 464 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 465 motor[TIRE_FL].pwm = 0;
yabahiro 21:1f1e9c585da8 466 motor[TIRE_FL].dir = FREE;
yabahiro 21:1f1e9c585da8 467 motor[TIRE_BR].pwm = 0;
yabahiro 21:1f1e9c585da8 468 motor[TIRE_BR].dir = FREE;
yabahiro 21:1f1e9c585da8 469 motor[TIRE_BL].pwm = 30;
yabahiro 21:1f1e9c585da8 470 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 471 mtc=true;
yabahiro 21:1f1e9c585da8 472 break;
yabahiro 21:1f1e9c585da8 473 case 1:
yabahiro 21:1f1e9c585da8 474 motor[TIRE_FR].pwm = 40;
yabahiro 21:1f1e9c585da8 475 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 476 motor[TIRE_FL].pwm = 60;
yabahiro 21:1f1e9c585da8 477 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 478 motor[TIRE_BR].pwm = 60;
yabahiro 21:1f1e9c585da8 479 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 480 motor[TIRE_BL].pwm = 40;
yabahiro 21:1f1e9c585da8 481 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 482 mtc=true;
yabahiro 21:1f1e9c585da8 483 break;
yabahiro 21:1f1e9c585da8 484 case 3:
yabahiro 21:1f1e9c585da8 485 motor[TIRE_FR].pwm = 0;
yabahiro 21:1f1e9c585da8 486 motor[TIRE_FR].dir = FREE;
yabahiro 21:1f1e9c585da8 487 motor[TIRE_FL].pwm = 20;
yabahiro 21:1f1e9c585da8 488 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 489 motor[TIRE_BR].pwm = 20;
yabahiro 21:1f1e9c585da8 490 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 491 motor[TIRE_BL].pwm = 0;
yabahiro 21:1f1e9c585da8 492 motor[TIRE_BL].dir = FREE;
yabahiro 21:1f1e9c585da8 493 mtc=true;
yabahiro 21:1f1e9c585da8 494 break;
yabahiro 21:1f1e9c585da8 495 case 2:
yabahiro 21:1f1e9c585da8 496 motor[TIRE_FR].pwm = 0;
yabahiro 21:1f1e9c585da8 497 motor[TIRE_FR].dir = FREE;
yabahiro 21:1f1e9c585da8 498 motor[TIRE_FL].pwm = 30;
yabahiro 21:1f1e9c585da8 499 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 500 motor[TIRE_BR].pwm = 30;
yabahiro 21:1f1e9c585da8 501 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 502 motor[TIRE_BL].pwm = 0;
yabahiro 21:1f1e9c585da8 503 motor[TIRE_BL].dir = FREE;
yabahiro 21:1f1e9c585da8 504 mtc=true;
yabahiro 21:1f1e9c585da8 505 break;
yabahiro 21:1f1e9c585da8 506 }
yabahiro 21:1f1e9c585da8 507 if(g[0]!=98&&mtc==true) {
yabahiro 21:1f1e9c585da8 508 switch(g[1]) {
yabahiro 21:1f1e9c585da8 509 case 0:
yabahiro 21:1f1e9c585da8 510 mtc=false;
yabahiro 21:1f1e9c585da8 511 break;
yabahiro 21:1f1e9c585da8 512 case 255:
yabahiro 21:1f1e9c585da8 513 motor[TIRE_BR].pwm += 5;
yabahiro 21:1f1e9c585da8 514 mtc=false;
yabahiro 21:1f1e9c585da8 515 break;
yabahiro 21:1f1e9c585da8 516 case 253:
yabahiro 21:1f1e9c585da8 517 motor[TIRE_BR].pwm += 10;
yabahiro 21:1f1e9c585da8 518 mtc=false;
yabahiro 21:1f1e9c585da8 519 break;
yabahiro 21:1f1e9c585da8 520 case 254:
yabahiro 21:1f1e9c585da8 521 motor[TIRE_BR].pwm += 20;
yabahiro 21:1f1e9c585da8 522 motor[TIRE_BL].pwm = 0;
yabahiro 21:1f1e9c585da8 523 mtc=false;
yabahiro 21:1f1e9c585da8 524 break;
yabahiro 21:1f1e9c585da8 525 case 1:
yabahiro 21:1f1e9c585da8 526 motor[TIRE_BL].pwm += 5;
yabahiro 21:1f1e9c585da8 527 mtc=false;
yabahiro 21:1f1e9c585da8 528 break;
yabahiro 21:1f1e9c585da8 529 case 3:
yabahiro 21:1f1e9c585da8 530 motor[TIRE_BL].pwm += 10;
yabahiro 21:1f1e9c585da8 531 mtc=false;
yabahiro 21:1f1e9c585da8 532 break;
yabahiro 21:1f1e9c585da8 533 case 2:
yabahiro 21:1f1e9c585da8 534 motor[TIRE_BL].pwm += 20;
yabahiro 21:1f1e9c585da8 535 motor[TIRE_BR].pwm = 0;
yabahiro 21:1f1e9c585da8 536 mtc=false;
yabahiro 21:1f1e9c585da8 537 break;
yabahiro 21:1f1e9c585da8 538 }
yabahiro 21:1f1e9c585da8 539 }
yabahiro 21:1f1e9c585da8 540 } else if(mode==1) {
yabahiro 21:1f1e9c585da8 541 motor[TIRE_FR].pwm = 5;
yabahiro 21:1f1e9c585da8 542 motor[TIRE_FR].dir = BACK;
yabahiro 21:1f1e9c585da8 543 motor[TIRE_FL].pwm = 5;
yabahiro 21:1f1e9c585da8 544 motor[TIRE_FL].dir = FOR;
yabahiro 21:1f1e9c585da8 545 motor[TIRE_BR].pwm = 5;
yabahiro 21:1f1e9c585da8 546 motor[TIRE_BR].dir = BACK;
yabahiro 21:1f1e9c585da8 547 motor[TIRE_BL].pwm = 5;
yabahiro 21:1f1e9c585da8 548 motor[TIRE_BL].dir = FOR;
yabahiro 21:1f1e9c585da8 549 if(g[2]==0) {
yabahiro 21:1f1e9c585da8 550 mode=2;
yabahiro 21:1f1e9c585da8 551 }
yabahiro 21:1f1e9c585da8 552 } else if(mode==2) {
yabahiro 21:1f1e9c585da8 553 motor[TIRE_FR].pwm = 15;
yabahiro 21:1f1e9c585da8 554 motor[TIRE_FR].dir = FOR;
yabahiro 21:1f1e9c585da8 555 motor[TIRE_FL].pwm = 15;
yabahiro 21:1f1e9c585da8 556 motor[TIRE_FL].dir = BACK;
yabahiro 21:1f1e9c585da8 557 motor[TIRE_BR].pwm = 15;
yabahiro 21:1f1e9c585da8 558 motor[TIRE_BR].dir = FOR;
yabahiro 21:1f1e9c585da8 559 motor[TIRE_BL].pwm = 15;
yabahiro 21:1f1e9c585da8 560 motor[TIRE_BL].dir = BACK;
yabahiro 21:1f1e9c585da8 561 mode1g0++;
yabahiro 21:1f1e9c585da8 562 if(mode1g0>10000&&g[2]==0) {
yabahiro 21:1f1e9c585da8 563 mode=3;
yabahiro 21:1f1e9c585da8 564 }
yabahiro 21:1f1e9c585da8 565 } else if(mode==3) {
yabahiro 21:1f1e9c585da8 566 motor[TIRE_FR].pwm = 0;
yabahiro 21:1f1e9c585da8 567 motor[TIRE_FR].dir = BRAKE;
yabahiro 21:1f1e9c585da8 568 motor[TIRE_FL].pwm = 0;
yabahiro 21:1f1e9c585da8 569 motor[TIRE_FL].dir = BRAKE;
yabahiro 21:1f1e9c585da8 570 motor[TIRE_BR].pwm = 0;
yabahiro 21:1f1e9c585da8 571 motor[TIRE_BR].dir = BRAKE;
yabahiro 21:1f1e9c585da8 572 motor[TIRE_BL].pwm = 0;
yabahiro 21:1f1e9c585da8 573 motor[TIRE_BL].dir = BRAKE;
yabahiro 21:1f1e9c585da8 574 } else {
yabahiro 21:1f1e9c585da8 575 motor[TIRE_FR].pwm = 0;
yabahiro 21:1f1e9c585da8 576 motor[TIRE_FR].dir = BRAKE;
yabahiro 21:1f1e9c585da8 577 motor[TIRE_FL].pwm = 0;
yabahiro 21:1f1e9c585da8 578 motor[TIRE_FL].dir = BRAKE;
yabahiro 21:1f1e9c585da8 579 motor[TIRE_BR].pwm = 0;
yabahiro 21:1f1e9c585da8 580 motor[TIRE_BR].dir = BRAKE;
yabahiro 21:1f1e9c585da8 581 motor[TIRE_BL].pwm = 0;
yabahiro 21:1f1e9c585da8 582 motor[TIRE_BL].dir = BRAKE;
yabahiro 21:1f1e9c585da8 583 }
yabahiro 21:1f1e9c585da8 584
kishibekairohan 13:b6e02d6261d7 585 }
kishibekairohan 13:b6e02d6261d7 586 #endif
kishibekairohan 13:b6e02d6261d7 587
kishibekairohan 13:b6e02d6261d7 588 #if USE_PROCESS_NUM>3
yabahiro 21:1f1e9c585da8 589 static void Process3()
kishibekairohan 13:b6e02d6261d7 590 {
kishibekairohan 13:b6e02d6261d7 591 }
kishibekairohan 13:b6e02d6261d7 592 #endif
kishibekairohan 13:b6e02d6261d7 593
kishibekairohan 13:b6e02d6261d7 594 #if USE_PROCESS_NUM>4
yabahiro 21:1f1e9c585da8 595 static void Process4()
yabahiro 21:1f1e9c585da8 596 {
kishibekairohan 15:dfcec98f5aa9 597
kishibekairohan 13:b6e02d6261d7 598 }
kishibekairohan 13:b6e02d6261d7 599 #endif
kishibekairohan 13:b6e02d6261d7 600
kishibekairohan 13:b6e02d6261d7 601 #if USE_PROCESS_NUM>5
yabahiro 21:1f1e9c585da8 602 static void Process5()
yabahiro 21:1f1e9c585da8 603 {
yabahiro 21:1f1e9c585da8 604
kishibekairohan 13:b6e02d6261d7 605 }
kishibekairohan 13:b6e02d6261d7 606 #endif
kishibekairohan 13:b6e02d6261d7 607
kishibekairohan 13:b6e02d6261d7 608 #if USE_PROCESS_NUM>6
yabahiro 21:1f1e9c585da8 609 static void Process6()
kishibekairohan 13:b6e02d6261d7 610 {
yabahiro 21:1f1e9c585da8 611
kishibekairohan 13:b6e02d6261d7 612 }
kishibekairohan 13:b6e02d6261d7 613 #endif
kishibekairohan 13:b6e02d6261d7 614
kishibekairohan 13:b6e02d6261d7 615 #if USE_PROCESS_NUM>7
kishibekairohan 13:b6e02d6261d7 616 static void Process7()
kishibekairohan 13:b6e02d6261d7 617 {
yabahiro 21:1f1e9c585da8 618
kishibekairohan 12:c09b3e08a316 619 }
kishibekairohan 12:c09b3e08a316 620 #endif
kishibekairohan 12:c09b3e08a316 621
yabahiro 21:1f1e9c585da8 622 #if USE_PROCESS_NUM>8
kishibekairohan 13:b6e02d6261d7 623 static void Process8()
kishibekairohan 12:c09b3e08a316 624 {
yabahiro 21:1f1e9c585da8 625
kishibekairohan 12:c09b3e08a316 626 }
kishibekairohan 12:c09b3e08a316 627 #endif
kishibekairohan 12:c09b3e08a316 628
kishibekairohan 13:b6e02d6261d7 629 #if USE_PROCESS_NUM>9
kishibekairohan 13:b6e02d6261d7 630 static void Process9()
kishibekairohan 12:c09b3e08a316 631 {
yabahiro 21:1f1e9c585da8 632
t_yamamoto 0:669ef71cba68 633 }
t_yamamoto 0:669ef71cba68 634 #endif
t_yamamoto 0:669ef71cba68 635 #endif
t_yamamoto 0:669ef71cba68 636 #pragma endregion PROCESS
t_yamamoto 0:669ef71cba68 637
t_yamamoto 0:669ef71cba68 638 static void AllActuatorReset()
t_yamamoto 0:669ef71cba68 639 {
t_yamamoto 0:669ef71cba68 640
yabahiro 21:1f1e9c585da8 641 #ifdef USE_SOLENOID
yabahiro 21:1f1e9c585da8 642 solenoid.all = ALL_SOLENOID_OFF;
yabahiro 21:1f1e9c585da8 643 #endif
t_yamamoto 0:669ef71cba68 644
yabahiro 21:1f1e9c585da8 645 #ifdef USE_MOTOR
yabahiro 21:1f1e9c585da8 646 for (uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) {
yabahiro 21:1f1e9c585da8 647 motor[i].dir = FREE;
yabahiro 21:1f1e9c585da8 648 motor[i].pwm = 0;
yabahiro 21:1f1e9c585da8 649 }
yabahiro 21:1f1e9c585da8 650 #endif
t_yamamoto 0:669ef71cba68 651 }
t_yamamoto 0:669ef71cba68 652
yabahiro 21:1f1e9c585da8 653 /*
yabahiro 21:1f1e9c585da8 654 void BuzzerTimer_func()
yabahiro 21:1f1e9c585da8 655 {
kishibekairohan 16:3f2c2d89372b 656 buzzer = !buzzer;
kishibekairohan 17:50dc4b449e69 657 //LED_DEBUG0 = !LED_DEBUG0;
kishibekairohan 11:028a150943b5 658 }
yabahiro 21:1f1e9c585da8 659 */
yabahiro 21:1f1e9c585da8 660 void TapeLedEms_func()
yabahiro 21:1f1e9c585da8 661 {
kishibekairohan 16:3f2c2d89372b 662 sendLedData.code = sendLedData.code == (uint32_t)Red ? (uint32_t)Black : (uint32_t)Red;
kishibekairohan 9:f93fc79a49ea 663 }
kishibekairohan 16:3f2c2d89372b 664
kishibekairohan 16:3f2c2d89372b 665 #pragma region USER-DEFINED-FUNCTIONS
kishibekairohan 16:3f2c2d89372b 666
kishibekairohan 16:3f2c2d89372b 667
t_yamamoto 0:669ef71cba68 668 #pragma endregion