Thomas Byrne / Mbed 2 deprecated HelloWorld_IHM02A1

Dependencies:   mbed tinyshell X_NUCLEO_IHM02A1

Committer:
tom_astranis
Date:
Thu Apr 01 18:03:26 2021 +0000
Revision:
29:a510e875936d
Parent:
28:19b25daa7777
Child:
30:a23204ee2be2
commands work

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Davidroid 0:5148e9486cf2 1 /**
Davidroid 0:5148e9486cf2 2 ******************************************************************************
Davidroid 0:5148e9486cf2 3 * @file main.cpp
Davidroid 12:5be6dd48b94a 4 * @author Davide Aliprandi, STMicroelectronics
Davidroid 0:5148e9486cf2 5 * @version V1.0.0
Davidroid 0:5148e9486cf2 6 * @date November 4th, 2015
Davidroid 12:5be6dd48b94a 7 * @brief mbed test application for the STMicroelectronics X-NUCLEO-IHM02A1
Davidroid 1:9f1974b0960d 8 * Motor Control Expansion Board: control of 2 motors.
Davidroid 0:5148e9486cf2 9 ******************************************************************************
Davidroid 0:5148e9486cf2 10 * @attention
Davidroid 0:5148e9486cf2 11 *
Davidroid 0:5148e9486cf2 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Davidroid 0:5148e9486cf2 13 *
Davidroid 0:5148e9486cf2 14 * Redistribution and use in source and binary forms, with or without modification,
Davidroid 0:5148e9486cf2 15 * are permitted provided that the following conditions are met:
Davidroid 0:5148e9486cf2 16 * 1. Redistributions of source code must retain the above copyright notice,
Davidroid 0:5148e9486cf2 17 * this list of conditions and the following disclaimer.
Davidroid 0:5148e9486cf2 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Davidroid 0:5148e9486cf2 19 * this list of conditions and the following disclaimer in the documentation
Davidroid 0:5148e9486cf2 20 * and/or other materials provided with the distribution.
Davidroid 0:5148e9486cf2 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Davidroid 0:5148e9486cf2 22 * may be used to endorse or promote products derived from this software
Davidroid 0:5148e9486cf2 23 * without specific prior written permission.
Davidroid 0:5148e9486cf2 24 *
Davidroid 0:5148e9486cf2 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Davidroid 0:5148e9486cf2 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Davidroid 0:5148e9486cf2 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Davidroid 0:5148e9486cf2 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Davidroid 0:5148e9486cf2 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Davidroid 0:5148e9486cf2 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Davidroid 0:5148e9486cf2 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Davidroid 0:5148e9486cf2 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Davidroid 0:5148e9486cf2 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Davidroid 0:5148e9486cf2 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Davidroid 0:5148e9486cf2 35 *
Davidroid 0:5148e9486cf2 36 ******************************************************************************
Davidroid 0:5148e9486cf2 37 */
Davidroid 0:5148e9486cf2 38
Davidroid 0:5148e9486cf2 39
Davidroid 0:5148e9486cf2 40 /* Includes ------------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 41
Davidroid 0:5148e9486cf2 42 /* mbed specific header files. */
Davidroid 0:5148e9486cf2 43 #include "mbed.h"
Davidroid 0:5148e9486cf2 44
Davidroid 0:5148e9486cf2 45 /* Helper header files. */
Davidroid 0:5148e9486cf2 46 #include "DevSPI.h"
Davidroid 0:5148e9486cf2 47
Davidroid 0:5148e9486cf2 48 /* Expansion Board specific header files. */
Davidroid 26:caec5f51abe8 49 #include "XNucleoIHM02A1.h"
Davidroid 0:5148e9486cf2 50
tom_astranis 28:19b25daa7777 51 /* Tinyshell: https://os.mbed.com/users/murilopontes/code/tinyshell/ */
tom_astranis 28:19b25daa7777 52 #include "tinysh.h"
Davidroid 0:5148e9486cf2 53
Davidroid 0:5148e9486cf2 54 /* Definitions ---------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 55
tom_astranis 27:2abcf13d90a3 56 /* Motor specs */
tom_astranis 27:2abcf13d90a3 57 #define MOTOR_SUPPLY_VOLTAGE_V 12.0
tom_astranis 27:2abcf13d90a3 58 #define STEPS_PER_REV 200.0
tom_astranis 27:2abcf13d90a3 59 #define MAX_PHASE_CURRENT_A 0.67
tom_astranis 27:2abcf13d90a3 60 #define PHASE_RES_OHMS 12.0
tom_astranis 27:2abcf13d90a3 61 #define MOTOR_INITIAL_SPEED_SPS 1000.0
tom_astranis 27:2abcf13d90a3 62 #define MOTOR_ACCEL_SPS2 200.0
tom_astranis 27:2abcf13d90a3 63 #define MOTOR_MAX_SPEED_SPS 2000.0
tom_astranis 27:2abcf13d90a3 64 #define FULL_STEP_TH_SPS 602.7
tom_astranis 27:2abcf13d90a3 65 #define DUMMY_KVAL_V 3.06
tom_astranis 27:2abcf13d90a3 66 #define BEMF_ICPT_SPS 61.52
tom_astranis 27:2abcf13d90a3 67 #define START_SLOPE 392.1569e-6
tom_astranis 27:2abcf13d90a3 68 #define FINAL_SLOPE 643.1372e-6
tom_astranis 27:2abcf13d90a3 69 #define OCD_TH_MA 600.0
tom_astranis 27:2abcf13d90a3 70 #define STALL_TH_MA 1000.0
tom_astranis 27:2abcf13d90a3 71
tom_astranis 28:19b25daa7777 72 /* Behavioral stuff */
tom_astranis 28:19b25daa7777 73 #define STATUS_LOG_RATE_HZ 1
tom_astranis 28:19b25daa7777 74 #define MIN_LOOP_TIME_MS 1
tom_astranis 28:19b25daa7777 75 #define HARD_STOP_WAIT_MS 100
tom_astranis 28:19b25daa7777 76
tom_astranis 28:19b25daa7777 77 #define CMD_BUFFER_SIZE 256
tom_astranis 28:19b25daa7777 78 #define OUTPUT_BUFFER_SIZE 1024
Davidroid 1:9f1974b0960d 79
Davidroid 1:9f1974b0960d 80 /* Number of steps. */
tom_astranis 27:2abcf13d90a3 81 #define STEPS_1 (20000 * 1) /* 1 revolution given a 200 step motor and 100:1 gearbox, with full stepping */
Davidroid 18:591a007effc2 82 #define STEPS_2 (STEPS_1 * 2)
tom_astranis 27:2abcf13d90a3 83 #define SPEED_SPS 10000 // steps per second
Davidroid 0:5148e9486cf2 84
tom_astranis 28:19b25daa7777 85 /* Number of movements per revolution. */
tom_astranis 28:19b25daa7777 86 #define MPR_1 4
tom_astranis 28:19b25daa7777 87
Davidroid 0:5148e9486cf2 88 /* Delay in milliseconds. */
Davidroid 1:9f1974b0960d 89 #define DELAY_1 1000
Davidroid 0:5148e9486cf2 90 #define DELAY_2 2000
Davidroid 0:5148e9486cf2 91 #define DELAY_3 5000
Davidroid 0:5148e9486cf2 92
Davidroid 0:5148e9486cf2 93
Davidroid 0:5148e9486cf2 94 /* Variables -----------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 95
Davidroid 0:5148e9486cf2 96 /* Motor Control Expansion Board. */
Davidroid 26:caec5f51abe8 97 XNucleoIHM02A1 *x_nucleo_ihm02a1;
Davidroid 0:5148e9486cf2 98
Davidroid 9:f35fbeedb8f4 99 /* Initialization parameters of the motors connected to the expansion board. */
davide.aliprandi@st.com 24:d1f487cb02ba 100 L6470_init_t init[L6470DAISYCHAINSIZE] = {
Davidroid 9:f35fbeedb8f4 101 /* First Motor. */
Davidroid 9:f35fbeedb8f4 102 {
tom_astranis 27:2abcf13d90a3 103 MOTOR_SUPPLY_VOLTAGE_V, /* Motor supply voltage in V. */
tom_astranis 27:2abcf13d90a3 104 STEPS_PER_REV, /* Min number of steps per revolution for the motor. */
tom_astranis 27:2abcf13d90a3 105 MAX_PHASE_CURRENT_A, /* Max motor phase voltage in A. */
tom_astranis 27:2abcf13d90a3 106 MAX_PHASE_CURRENT_A * PHASE_RES_OHMS, /* Max motor phase voltage in V. (12 ohms per phase) */
tom_astranis 27:2abcf13d90a3 107 MOTOR_INITIAL_SPEED_SPS, /* Motor initial speed [step/s]. */
tom_astranis 27:2abcf13d90a3 108 MOTOR_ACCEL_SPS2, /* Motor acceleration [step/s^2] (comment for infinite acceleration mode). */
tom_astranis 27:2abcf13d90a3 109 MOTOR_ACCEL_SPS2, /* Motor deceleration [step/s^2] (comment for infinite deceleration mode). */
tom_astranis 27:2abcf13d90a3 110 MOTOR_MAX_SPEED_SPS, /* Motor maximum speed [step/s]. */
tom_astranis 27:2abcf13d90a3 111 0.0, /* Motor minimum speed [step/s]. */
tom_astranis 27:2abcf13d90a3 112 FULL_STEP_TH_SPS, /* Motor full-step speed threshold [step/s]. */
tom_astranis 27:2abcf13d90a3 113 DUMMY_KVAL_V, /* Holding kval [V]. */
tom_astranis 27:2abcf13d90a3 114 DUMMY_KVAL_V, /* Constant speed kval [V]. */
tom_astranis 27:2abcf13d90a3 115 DUMMY_KVAL_V, /* Acceleration starting kval [V]. */
tom_astranis 27:2abcf13d90a3 116 DUMMY_KVAL_V, /* Deceleration starting kval [V]. */
tom_astranis 27:2abcf13d90a3 117 BEMF_ICPT_SPS, /* Intersect speed for bemf compensation curve slope changing [step/s]. */
tom_astranis 27:2abcf13d90a3 118 START_SLOPE, /* Start slope [s/step]. */
tom_astranis 27:2abcf13d90a3 119 FINAL_SLOPE, /* Acceleration final slope [s/step]. */
tom_astranis 27:2abcf13d90a3 120 FINAL_SLOPE, /* Deceleration final slope [s/step]. */
tom_astranis 27:2abcf13d90a3 121 0, /* Thermal compensation factor (range [0, 15]). */
tom_astranis 27:2abcf13d90a3 122 OCD_TH_MA, /* Ocd threshold [ma] (range [375 ma, 6000 ma]). */
tom_astranis 27:2abcf13d90a3 123 STALL_TH_MA, /* Stall threshold [ma] (range [31.25 ma, 4000 ma]). */
tom_astranis 27:2abcf13d90a3 124 StepperMotor::STEP_MODE_FULL, /* Step mode selection. */
tom_astranis 27:2abcf13d90a3 125 0xFF, /* Alarm conditions enable. */
tom_astranis 27:2abcf13d90a3 126 0x2E88 /* Ic configuration. */
Davidroid 9:f35fbeedb8f4 127 },
Davidroid 9:f35fbeedb8f4 128
Davidroid 9:f35fbeedb8f4 129 /* Second Motor. */
Davidroid 9:f35fbeedb8f4 130 {
tom_astranis 27:2abcf13d90a3 131 MOTOR_SUPPLY_VOLTAGE_V, /* Motor supply voltage in V. */
tom_astranis 27:2abcf13d90a3 132 STEPS_PER_REV, /* Min number of steps per revolution for the motor. */
tom_astranis 27:2abcf13d90a3 133 MAX_PHASE_CURRENT_A, /* Max motor phase voltage in A. */
tom_astranis 27:2abcf13d90a3 134 MAX_PHASE_CURRENT_A * PHASE_RES_OHMS, /* Max motor phase voltage in V. (12 ohms per phase) */
tom_astranis 27:2abcf13d90a3 135 MOTOR_INITIAL_SPEED_SPS, /* Motor initial speed [step/s]. */
tom_astranis 27:2abcf13d90a3 136 MOTOR_ACCEL_SPS2, /* Motor acceleration [step/s^2] (comment for infinite acceleration mode). */
tom_astranis 27:2abcf13d90a3 137 MOTOR_ACCEL_SPS2, /* Motor deceleration [step/s^2] (comment for infinite deceleration mode). */
tom_astranis 27:2abcf13d90a3 138 MOTOR_MAX_SPEED_SPS, /* Motor maximum speed [step/s]. */
tom_astranis 27:2abcf13d90a3 139 0.0, /* Motor minimum speed [step/s]. */
tom_astranis 27:2abcf13d90a3 140 FULL_STEP_TH_SPS, /* Motor full-step speed threshold [step/s]. */
tom_astranis 27:2abcf13d90a3 141 DUMMY_KVAL_V, /* Holding kval [V]. */
tom_astranis 27:2abcf13d90a3 142 DUMMY_KVAL_V, /* Constant speed kval [V]. */
tom_astranis 27:2abcf13d90a3 143 DUMMY_KVAL_V, /* Acceleration starting kval [V]. */
tom_astranis 27:2abcf13d90a3 144 DUMMY_KVAL_V, /* Deceleration starting kval [V]. */
tom_astranis 27:2abcf13d90a3 145 BEMF_ICPT_SPS, /* Intersect speed for bemf compensation curve slope changing [step/s]. */
tom_astranis 27:2abcf13d90a3 146 START_SLOPE, /* Start slope [s/step]. */
tom_astranis 27:2abcf13d90a3 147 FINAL_SLOPE, /* Acceleration final slope [s/step]. */
tom_astranis 27:2abcf13d90a3 148 FINAL_SLOPE, /* Deceleration final slope [s/step]. */
tom_astranis 27:2abcf13d90a3 149 0, /* Thermal compensation factor (range [0, 15]). */
tom_astranis 27:2abcf13d90a3 150 OCD_TH_MA, /* Ocd threshold [ma] (range [375 ma, 6000 ma]). */
tom_astranis 27:2abcf13d90a3 151 STALL_TH_MA, /* Stall threshold [ma] (range [31.25 ma, 4000 ma]). */
tom_astranis 27:2abcf13d90a3 152 StepperMotor::STEP_MODE_FULL, /* Step mode selection. */
tom_astranis 27:2abcf13d90a3 153 0xFF, /* Alarm conditions enable. */
tom_astranis 27:2abcf13d90a3 154 0x2E88 /* Ic configuration. */
Davidroid 9:f35fbeedb8f4 155 }
Davidroid 9:f35fbeedb8f4 156 };
Davidroid 9:f35fbeedb8f4 157
tom_astranis 28:19b25daa7777 158 /* Serial Port for console */
tom_astranis 28:19b25daa7777 159 Serial pc(USBTX, USBRX);
tom_astranis 28:19b25daa7777 160
tom_astranis 28:19b25daa7777 161 /* Nasty globals haha */
tom_astranis 28:19b25daa7777 162 bool limit_flag = false;
tom_astranis 28:19b25daa7777 163 bool status_flag = false;
tom_astranis 29:a510e875936d 164 bool run_flag = false;
tom_astranis 29:a510e875936d 165 bool stop_flag = false;
tom_astranis 28:19b25daa7777 166
tom_astranis 28:19b25daa7777 167 /* Tinyshell command handler functions */
tom_astranis 29:a510e875936d 168 void set_status_flag(int argc, char **argv)
tom_astranis 28:19b25daa7777 169 {
tom_astranis 28:19b25daa7777 170 status_flag = true;
tom_astranis 28:19b25daa7777 171 }
tom_astranis 28:19b25daa7777 172
tom_astranis 29:a510e875936d 173 void set_run_flag(int argc, char **argv)
tom_astranis 29:a510e875936d 174 {
tom_astranis 29:a510e875936d 175 run_flag = true;
tom_astranis 29:a510e875936d 176 }
tom_astranis 29:a510e875936d 177
tom_astranis 29:a510e875936d 178 void set_stop_flag(int argc, char **argv)
tom_astranis 29:a510e875936d 179 {
tom_astranis 29:a510e875936d 180 stop_flag = true;
tom_astranis 29:a510e875936d 181 }
tom_astranis 29:a510e875936d 182
tom_astranis 28:19b25daa7777 183 // parent cmd (0 for top) cmd input name, help string, usage string,
tom_astranis 28:19b25daa7777 184 // function to launch, arg when called, next (0 at init), child (0 at init)
tom_astranis 29:a510e875936d 185 tinysh_cmd_t print_status_cmd = {0, "status", "status command", "[args]", set_status_flag,0,0,0};
tom_astranis 29:a510e875936d 186 tinysh_cmd_t run_cmd = {0, "run", "run command", "[args]", set_run_flag,0,0,0};
tom_astranis 29:a510e875936d 187 tinysh_cmd_t stop_cmd = {0, "stop", "stop command", "[args]", set_stop_flag,0,0,0};
tom_astranis 28:19b25daa7777 188
tom_astranis 28:19b25daa7777 189 /* mandatory tiny shell output function */
tom_astranis 28:19b25daa7777 190 void tinysh_char_out(unsigned char c)
tom_astranis 28:19b25daa7777 191 {
tom_astranis 28:19b25daa7777 192 pc.putc(c);
tom_astranis 28:19b25daa7777 193 }
Davidroid 0:5148e9486cf2 194
Davidroid 0:5148e9486cf2 195 /* Main ----------------------------------------------------------------------*/
Davidroid 0:5148e9486cf2 196
Davidroid 0:5148e9486cf2 197 int main()
Davidroid 0:5148e9486cf2 198 {
Davidroid 1:9f1974b0960d 199 /*----- Initialization. -----*/
tom_astranis 28:19b25daa7777 200 unsigned int status_bytes[L6470DAISYCHAINSIZE];
tom_astranis 28:19b25daa7777 201
tom_astranis 28:19b25daa7777 202 /* Set up tinyshell */
tom_astranis 28:19b25daa7777 203 pc.baud(115200);
tom_astranis 28:19b25daa7777 204 pc.printf("Motor controller ready\r\n");
tom_astranis 28:19b25daa7777 205 tinysh_set_prompt("$ ");
tom_astranis 28:19b25daa7777 206
tom_astranis 28:19b25daa7777 207 // Add all tinyshell commands here
tom_astranis 28:19b25daa7777 208 tinysh_add_command(&print_status_cmd);
tom_astranis 29:a510e875936d 209 tinysh_add_command(&run_cmd);
tom_astranis 29:a510e875936d 210 tinysh_add_command(&stop_cmd);
Davidroid 1:9f1974b0960d 211
Davidroid 2:41eeee48951b 212 /* Initializing SPI bus. */
Davidroid 23:073b26366d03 213 #ifdef TARGET_STM32F429
Davidroid 23:073b26366d03 214 DevSPI dev_spi(D11, D12, D13);
Davidroid 23:073b26366d03 215 #else
Davidroid 3:fd280b953f77 216 DevSPI dev_spi(D11, D12, D3);
Davidroid 23:073b26366d03 217 #endif
Davidroid 0:5148e9486cf2 218
Davidroid 5:3b8e19bbf386 219 /* Initializing Motor Control Expansion Board. */
Davidroid 26:caec5f51abe8 220 x_nucleo_ihm02a1 = new XNucleoIHM02A1(&init[0], &init[1], A4, A5, D4, A2, &dev_spi);
Davidroid 0:5148e9486cf2 221
Davidroid 1:9f1974b0960d 222 /* Building a list of motor control components. */
davide.aliprandi@st.com 24:d1f487cb02ba 223 L6470 **motors = x_nucleo_ihm02a1->get_components();
tom_astranis 29:a510e875936d 224
tom_astranis 28:19b25daa7777 225 // Main loop
tom_astranis 28:19b25daa7777 226 while(1) {
tom_astranis 28:19b25daa7777 227 /* 1: Check for hardware flags ----------------------------------------*/
tom_astranis 28:19b25daa7777 228 if (limit_flag) {
tom_astranis 29:a510e875936d 229 // clear flag
tom_astranis 29:a510e875936d 230 limit_flag = false;
tom_astranis 29:a510e875936d 231
tom_astranis 28:19b25daa7777 232 // Hard stop
tom_astranis 28:19b25daa7777 233 for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 28:19b25daa7777 234 motors[m]->prepare_hard_stop();
tom_astranis 28:19b25daa7777 235 }
tom_astranis 28:19b25daa7777 236 x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 28:19b25daa7777 237
tom_astranis 28:19b25daa7777 238 wait_ms(HARD_STOP_WAIT_MS);
tom_astranis 28:19b25daa7777 239
tom_astranis 28:19b25daa7777 240 // High Z
tom_astranis 28:19b25daa7777 241 for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 28:19b25daa7777 242 motors[m]->prepare_hard_hiz();
tom_astranis 28:19b25daa7777 243 }
tom_astranis 28:19b25daa7777 244 x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 28:19b25daa7777 245
tom_astranis 28:19b25daa7777 246 printf("Reached limit.\r\n");
tom_astranis 28:19b25daa7777 247 }
tom_astranis 28:19b25daa7777 248
tom_astranis 28:19b25daa7777 249 /* 2: Fetch new chars for Tinyshell ----------------------------------*/
tom_astranis 28:19b25daa7777 250 tinysh_char_in(pc.getc());
tom_astranis 28:19b25daa7777 251
tom_astranis 28:19b25daa7777 252 /* 3: Handle Commands ------------------------------------------------*/
tom_astranis 29:a510e875936d 253 if (run_flag) {
tom_astranis 29:a510e875936d 254 run_flag = false;
tom_astranis 29:a510e875936d 255 // Hello world: just run the damn motor forever
tom_astranis 29:a510e875936d 256 printf("Running.\r\n");
tom_astranis 29:a510e875936d 257 for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 29:a510e875936d 258 motors[m]->prepare_run(StepperMotor::BWD, SPEED_SPS);
tom_astranis 29:a510e875936d 259 }
tom_astranis 29:a510e875936d 260 x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 29:a510e875936d 261 }
tom_astranis 29:a510e875936d 262
tom_astranis 29:a510e875936d 263 if (stop_flag) {
tom_astranis 29:a510e875936d 264 stop_flag = false;
tom_astranis 29:a510e875936d 265 // Hard stop
tom_astranis 29:a510e875936d 266 printf("Stopping.\r\n");
tom_astranis 29:a510e875936d 267 for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 29:a510e875936d 268 motors[m]->prepare_hard_stop();
tom_astranis 29:a510e875936d 269 }
tom_astranis 29:a510e875936d 270 x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 29:a510e875936d 271
tom_astranis 29:a510e875936d 272 wait_ms(HARD_STOP_WAIT_MS);
tom_astranis 29:a510e875936d 273
tom_astranis 29:a510e875936d 274 // High Z
tom_astranis 29:a510e875936d 275 for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 29:a510e875936d 276 motors[m]->prepare_hard_hiz();
tom_astranis 29:a510e875936d 277 }
tom_astranis 29:a510e875936d 278 x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 29:a510e875936d 279 }
tom_astranis 29:a510e875936d 280
tom_astranis 28:19b25daa7777 281 if (status_flag) {
tom_astranis 29:a510e875936d 282 // clear flag
tom_astranis 29:a510e875936d 283 status_flag = false;
tom_astranis 29:a510e875936d 284
tom_astranis 28:19b25daa7777 285 // Fetch and parse the status register for each motor
tom_astranis 28:19b25daa7777 286 for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 28:19b25daa7777 287 status_bytes[m] = motors[m]->get_status();
tom_astranis 28:19b25daa7777 288 printf("Status reg %d: 0x%02X\r\n", m, status_bytes[m]);
tom_astranis 28:19b25daa7777 289 printf(" STEP-CLOCK MODE: ");
tom_astranis 28:19b25daa7777 290 printf(status_bytes[m] & 0x8000 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 291 printf(" STEP_LOSS_B: ");
tom_astranis 28:19b25daa7777 292 printf(status_bytes[m] & 0x4000 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 293 printf(" STEP_LOSS_A: ");
tom_astranis 28:19b25daa7777 294 printf(status_bytes[m] & 0x2000 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 295 printf(" OVERCURRENT DETECT: ");
tom_astranis 28:19b25daa7777 296 printf(status_bytes[m] & 0x1000 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 297 printf(" THERMAL SHUTDOWN: ");
tom_astranis 28:19b25daa7777 298 printf(status_bytes[m] & 0x0800 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 299 printf(" THERMAL WARN: ");
tom_astranis 28:19b25daa7777 300 printf(status_bytes[m] & 0x0400 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 301 printf(" UNDERVOLTAGE LOCKOUT: ");
tom_astranis 28:19b25daa7777 302 printf(status_bytes[m] & 0x0200 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 303 printf(" WRONG_CMD: ");
tom_astranis 28:19b25daa7777 304 printf(status_bytes[m] & 0x0100 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 305 printf(" NOTPERF_CMD: ");
tom_astranis 28:19b25daa7777 306 printf(status_bytes[m] & 0x0080 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 307 printf(" MOTOR_STATUS: ");
tom_astranis 28:19b25daa7777 308 if ((status_bytes[m] && 0x0060) >> 5 == 0x00) printf("STOPPED\r\n");
tom_astranis 28:19b25daa7777 309 if ((status_bytes[m] && 0x0060) >> 5 == 0x01) printf("ACCELERATING\r\n");
tom_astranis 28:19b25daa7777 310 if ((status_bytes[m] && 0x0060) >> 5 == 0x10) printf("DECELERATING\r\n");
tom_astranis 28:19b25daa7777 311 if ((status_bytes[m] && 0x0060) >> 5 == 0x11) printf("CONSTANT SPEED\r\n");
tom_astranis 28:19b25daa7777 312 printf(" DIRECTION: ");
tom_astranis 28:19b25daa7777 313 printf(status_bytes[m] & 0x0010 ? "FWD\r\n" : "REV\r\n");
tom_astranis 28:19b25daa7777 314 printf(" SWITCH TURN-ON EVENT: ");
tom_astranis 28:19b25daa7777 315 printf(status_bytes[m] & 0x0008 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 316 printf(" SWITCH STATUS: ");
tom_astranis 28:19b25daa7777 317 printf(status_bytes[m] & 0x0004 ? "CLOSED\r\n" : "OPEN\r\n");
tom_astranis 28:19b25daa7777 318 printf(" BUSY: ");
tom_astranis 28:19b25daa7777 319 printf(status_bytes[m] & 0x0002 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 320 printf(" HI_Z: ");
tom_astranis 28:19b25daa7777 321 printf(status_bytes[m] & 0x0001 ? "SET\r\n" : "NOT SET\r\n");
tom_astranis 28:19b25daa7777 322 printf("\n\n");
tom_astranis 28:19b25daa7777 323 }
tom_astranis 28:19b25daa7777 324 }
tom_astranis 28:19b25daa7777 325
tom_astranis 28:19b25daa7777 326 } // end main loop
tom_astranis 27:2abcf13d90a3 327 }
Davidroid 0:5148e9486cf2 328
Davidroid 0:5148e9486cf2 329
tom_astranis 27:2abcf13d90a3 330 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 331 // printf("--> Setting home position.\r\n");
tom_astranis 27:2abcf13d90a3 332 //
tom_astranis 27:2abcf13d90a3 333 // /* Setting the home position. */
tom_astranis 27:2abcf13d90a3 334 // motors[0]->set_home();
Davidroid 0:5148e9486cf2 335
tom_astranis 27:2abcf13d90a3 336 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 337 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 338 //
tom_astranis 27:2abcf13d90a3 339 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 340 // int position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 341 //
tom_astranis 27:2abcf13d90a3 342 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 343 // printf("--> Getting the current position: %d\r\n", position);
Davidroid 1:9f1974b0960d 344
tom_astranis 27:2abcf13d90a3 345 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 346 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 347 //
tom_astranis 27:2abcf13d90a3 348 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 349 // printf("--> Moving forward %d steps.\r\n", STEPS_1);
tom_astranis 27:2abcf13d90a3 350 //
tom_astranis 27:2abcf13d90a3 351 // /* Moving. */
tom_astranis 27:2abcf13d90a3 352 // motors[0]->move(StepperMotor::FWD, STEPS_1);
tom_astranis 27:2abcf13d90a3 353 //
tom_astranis 27:2abcf13d90a3 354 // /* Waiting while active. */
tom_astranis 27:2abcf13d90a3 355 // motors[0]->wait_while_active();
tom_astranis 27:2abcf13d90a3 356 //
tom_astranis 27:2abcf13d90a3 357 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 358 // position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 359 //
tom_astranis 27:2abcf13d90a3 360 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 361 // printf("--> Getting the current position: %d\r\n", position);
tom_astranis 27:2abcf13d90a3 362 //
tom_astranis 27:2abcf13d90a3 363 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 364 // printf("--> Marking the current position.\r\n");
tom_astranis 27:2abcf13d90a3 365 //
tom_astranis 27:2abcf13d90a3 366 // /* Marking the current position. */
tom_astranis 27:2abcf13d90a3 367 // motors[0]->set_mark();
tom_astranis 27:2abcf13d90a3 368 //
tom_astranis 27:2abcf13d90a3 369 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 370 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 371 //
tom_astranis 27:2abcf13d90a3 372 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 373 // printf("--> Moving backward %d steps.\r\n", STEPS_2);
tom_astranis 27:2abcf13d90a3 374 //
tom_astranis 27:2abcf13d90a3 375 // /* Moving. */
tom_astranis 27:2abcf13d90a3 376 // motors[0]->move(StepperMotor::BWD, STEPS_2);
tom_astranis 27:2abcf13d90a3 377 //
tom_astranis 27:2abcf13d90a3 378 // /* Waiting while active. */
tom_astranis 27:2abcf13d90a3 379 // motors[0]->wait_while_active();
tom_astranis 27:2abcf13d90a3 380 //
tom_astranis 27:2abcf13d90a3 381 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 382 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 383 //
tom_astranis 27:2abcf13d90a3 384 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 385 // position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 386 //
tom_astranis 27:2abcf13d90a3 387 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 388 // printf("--> Getting the current position: %d\r\n", position);
tom_astranis 27:2abcf13d90a3 389 //
tom_astranis 27:2abcf13d90a3 390 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 391 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 392 //
tom_astranis 27:2abcf13d90a3 393 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 394 // printf("--> Going to marked position.\r\n");
tom_astranis 27:2abcf13d90a3 395 //
tom_astranis 27:2abcf13d90a3 396 // /* Going to marked position. */
tom_astranis 27:2abcf13d90a3 397 // motors[0]->go_mark();
tom_astranis 27:2abcf13d90a3 398 //
tom_astranis 27:2abcf13d90a3 399 // /* Waiting while active. */
tom_astranis 27:2abcf13d90a3 400 // motors[0]->wait_while_active();
tom_astranis 27:2abcf13d90a3 401 //
tom_astranis 27:2abcf13d90a3 402 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 403 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 404 //
tom_astranis 27:2abcf13d90a3 405 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 406 // position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 407 //
tom_astranis 27:2abcf13d90a3 408 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 409 // printf("--> Getting the current position: %d\r\n", position);
tom_astranis 27:2abcf13d90a3 410 //
tom_astranis 27:2abcf13d90a3 411 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 412 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 413 //
tom_astranis 27:2abcf13d90a3 414 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 415 // printf("--> Going to home position.\r\n");
tom_astranis 27:2abcf13d90a3 416 //
tom_astranis 27:2abcf13d90a3 417 // /* Going to home position. */
tom_astranis 27:2abcf13d90a3 418 // motors[0]->go_home();
tom_astranis 27:2abcf13d90a3 419 //
tom_astranis 27:2abcf13d90a3 420 // /* Waiting while active. */
tom_astranis 27:2abcf13d90a3 421 // motors[0]->wait_while_active();
tom_astranis 27:2abcf13d90a3 422 //
tom_astranis 27:2abcf13d90a3 423 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 424 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 425 //
tom_astranis 27:2abcf13d90a3 426 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 427 // position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 428 //
tom_astranis 27:2abcf13d90a3 429 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 430 // printf("--> Getting the current position: %d\r\n", position);
tom_astranis 27:2abcf13d90a3 431 //
tom_astranis 27:2abcf13d90a3 432 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 433 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 434 //
tom_astranis 27:2abcf13d90a3 435 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 436 // printf("--> Halving the microsteps.\r\n");
tom_astranis 27:2abcf13d90a3 437 //
tom_astranis 27:2abcf13d90a3 438 // /* Halving the microsteps. */
tom_astranis 27:2abcf13d90a3 439 // init[0].step_sel = (init[0].step_sel > 0 ? init[0].step_sel - 1 : init[0].step_sel);
tom_astranis 27:2abcf13d90a3 440 // if (!motors[0]->set_step_mode((StepperMotor::step_mode_t) init[0].step_sel)) {
tom_astranis 27:2abcf13d90a3 441 // printf(" Step Mode not allowed.\r\n");
tom_astranis 27:2abcf13d90a3 442 // }
tom_astranis 27:2abcf13d90a3 443 //
tom_astranis 27:2abcf13d90a3 444 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 445 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 446 //
tom_astranis 27:2abcf13d90a3 447 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 448 // printf("--> Setting home position.\r\n");
tom_astranis 27:2abcf13d90a3 449 //
tom_astranis 27:2abcf13d90a3 450 // /* Setting the home position. */
tom_astranis 27:2abcf13d90a3 451 // motors[0]->set_home();
tom_astranis 27:2abcf13d90a3 452 //
tom_astranis 27:2abcf13d90a3 453 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 454 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 455 //
tom_astranis 27:2abcf13d90a3 456 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 457 // position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 458 //
tom_astranis 27:2abcf13d90a3 459 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 460 // printf("--> Getting the current position: %d\r\n", position);
tom_astranis 27:2abcf13d90a3 461 //
tom_astranis 27:2abcf13d90a3 462 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 463 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 464 //
tom_astranis 27:2abcf13d90a3 465 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 466 // printf("--> Moving forward %d steps.\r\n", STEPS_1);
tom_astranis 27:2abcf13d90a3 467 //
tom_astranis 27:2abcf13d90a3 468 // /* Moving. */
tom_astranis 27:2abcf13d90a3 469 // motors[0]->move(StepperMotor::FWD, STEPS_1);
tom_astranis 27:2abcf13d90a3 470 //
tom_astranis 27:2abcf13d90a3 471 // /* Waiting while active. */
tom_astranis 27:2abcf13d90a3 472 // motors[0]->wait_while_active();
tom_astranis 27:2abcf13d90a3 473 //
tom_astranis 27:2abcf13d90a3 474 // /* Getting the current position. */
tom_astranis 27:2abcf13d90a3 475 // position = motors[0]->get_position();
tom_astranis 27:2abcf13d90a3 476 //
tom_astranis 27:2abcf13d90a3 477 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 478 // printf("--> Getting the current position: %d\r\n", position);
tom_astranis 27:2abcf13d90a3 479 //
tom_astranis 27:2abcf13d90a3 480 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 481 // printf("--> Marking the current position.\r\n");
tom_astranis 27:2abcf13d90a3 482 //
tom_astranis 27:2abcf13d90a3 483 // /* Marking the current position. */
tom_astranis 27:2abcf13d90a3 484 // motors[0]->set_mark();
tom_astranis 27:2abcf13d90a3 485 //
tom_astranis 27:2abcf13d90a3 486 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 487 // wait_ms(DELAY_2);
tom_astranis 27:2abcf13d90a3 488 //
tom_astranis 27:2abcf13d90a3 489 //
tom_astranis 27:2abcf13d90a3 490 // /*----- Running together for a certain amount of time. -----*/
tom_astranis 27:2abcf13d90a3 491 //
tom_astranis 27:2abcf13d90a3 492 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 493 // printf("--> Running together for %d seconds.\r\n", DELAY_3 / 1000);
tom_astranis 27:2abcf13d90a3 494 //
tom_astranis 27:2abcf13d90a3 495 // /* Preparing each motor to perform a run at a specified speed. */
tom_astranis 27:2abcf13d90a3 496 // for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 27:2abcf13d90a3 497 // motors[m]->prepare_run(StepperMotor::BWD, 400);
tom_astranis 27:2abcf13d90a3 498 // }
tom_astranis 27:2abcf13d90a3 499 //
tom_astranis 27:2abcf13d90a3 500 // /* Performing the action on each motor at the same time. */
tom_astranis 27:2abcf13d90a3 501 // x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 27:2abcf13d90a3 502 //
tom_astranis 27:2abcf13d90a3 503 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 504 // wait_ms(DELAY_3);
tom_astranis 27:2abcf13d90a3 505 //
tom_astranis 27:2abcf13d90a3 506 //
tom_astranis 27:2abcf13d90a3 507 // /*----- Increasing the speed while running. -----*/
tom_astranis 27:2abcf13d90a3 508 //
tom_astranis 27:2abcf13d90a3 509 // /* Preparing each motor to perform a run at a specified speed. */
tom_astranis 27:2abcf13d90a3 510 // for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 27:2abcf13d90a3 511 // motors[m]->prepare_get_speed();
tom_astranis 27:2abcf13d90a3 512 // }
tom_astranis 27:2abcf13d90a3 513 //
tom_astranis 27:2abcf13d90a3 514 // /* Performing the action on each motor at the same time. */
tom_astranis 27:2abcf13d90a3 515 // uint32_t* results = x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 27:2abcf13d90a3 516 //
tom_astranis 27:2abcf13d90a3 517 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 518 // printf(" Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
tom_astranis 27:2abcf13d90a3 519 //
tom_astranis 27:2abcf13d90a3 520 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 521 // printf("--> Doublig the speed while running again for %d seconds.\r\n", DELAY_3 / 1000);
tom_astranis 27:2abcf13d90a3 522 //
tom_astranis 27:2abcf13d90a3 523 // /* Preparing each motor to perform a run at a specified speed. */
tom_astranis 27:2abcf13d90a3 524 // for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 27:2abcf13d90a3 525 // motors[m]->prepare_run(StepperMotor::BWD, results[m] << 1);
tom_astranis 27:2abcf13d90a3 526 // }
tom_astranis 27:2abcf13d90a3 527 //
tom_astranis 27:2abcf13d90a3 528 // /* Performing the action on each motor at the same time. */
tom_astranis 27:2abcf13d90a3 529 // results = x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 27:2abcf13d90a3 530 //
tom_astranis 27:2abcf13d90a3 531 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 532 // wait_ms(DELAY_3);
tom_astranis 27:2abcf13d90a3 533 //
tom_astranis 27:2abcf13d90a3 534 // /* Preparing each motor to perform a run at a specified speed. */
tom_astranis 27:2abcf13d90a3 535 // for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 27:2abcf13d90a3 536 // motors[m]->prepare_get_speed();
tom_astranis 27:2abcf13d90a3 537 // }
tom_astranis 27:2abcf13d90a3 538 //
tom_astranis 27:2abcf13d90a3 539 // /* Performing the action on each motor at the same time. */
tom_astranis 27:2abcf13d90a3 540 // results = x_nucleo_ihm02a1->perform_prepared_actions();
tom_astranis 27:2abcf13d90a3 541 //
tom_astranis 27:2abcf13d90a3 542 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 543 // printf(" Speed: M1 %d, M2 %d.\r\n", results[0], results[1]);
tom_astranis 27:2abcf13d90a3 544 //
tom_astranis 27:2abcf13d90a3 545 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 546 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 547 //
tom_astranis 27:2abcf13d90a3 548 //
tom_astranis 27:2abcf13d90a3 549 // /*----- Doing a full revolution on each motor, one after the other. -----*/
tom_astranis 27:2abcf13d90a3 550 //
tom_astranis 27:2abcf13d90a3 551 // /* Printing to the console. */
tom_astranis 27:2abcf13d90a3 552 // printf("--> Doing a full revolution on each motor, one after the other.\r\n");
tom_astranis 27:2abcf13d90a3 553 //
tom_astranis 27:2abcf13d90a3 554 // /* Doing a full revolution on each motor, one after the other. */
tom_astranis 27:2abcf13d90a3 555 // for (int m = 0; m < L6470DAISYCHAINSIZE; m++) {
tom_astranis 27:2abcf13d90a3 556 // for (int i = 0; i < MPR_1; i++) {
tom_astranis 27:2abcf13d90a3 557 // /* Computing the number of steps. */
tom_astranis 27:2abcf13d90a3 558 // int steps = (int) (((int) init[m].fullstepsperrevolution * pow(2.0f, init[m].step_sel)) / MPR_1);
tom_astranis 27:2abcf13d90a3 559 //
tom_astranis 27:2abcf13d90a3 560 // /* Moving. */
tom_astranis 27:2abcf13d90a3 561 // motors[m]->move(StepperMotor::FWD, steps);
tom_astranis 27:2abcf13d90a3 562 //
tom_astranis 27:2abcf13d90a3 563 // /* Waiting while active. */
tom_astranis 27:2abcf13d90a3 564 // motors[m]->wait_while_active();
tom_astranis 27:2abcf13d90a3 565 //
tom_astranis 27:2abcf13d90a3 566 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 567 // wait_ms(DELAY_1);
tom_astranis 27:2abcf13d90a3 568 // }
tom_astranis 27:2abcf13d90a3 569 // }
tom_astranis 27:2abcf13d90a3 570 //
tom_astranis 27:2abcf13d90a3 571 // /* Waiting. */
tom_astranis 27:2abcf13d90a3 572 // wait_ms(DELAY_2);
tom_astranis 27:2abcf13d90a3 573 //
tom_astranis 27:2abcf13d90a3 574 //}