Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: USBDevice mbed motor
Fork of mbed_mainboard_source by
definitions.h
00001 #ifndef DEFINITIONS_H_ 00002 #define DEFINITIONS_H_ value 00003 00004 #define NUMBER_OF_MOTORS 3 00005 00006 #define MOTOR_PWM(n) MOTOR ## n ## _PWM 00007 #define MOTOR_DIR1(n) MOTOR ## n ## _DIR1 00008 #define MOTOR_DIR2(n) MOTOR ## n ## _DIR2 00009 #define MOTOR_FAULT(n) MOTOR ## n ## _FAULT 00010 #define MOTOR_ENCA(n) MOTOR ## n ## _ENCA 00011 #define MOTOR_ENCB(n) MOTOR ## n ## _ENCB 00012 00013 #define MOTOR_ENC_TICK(i) void motor ## i ## EncTick() { \ 00014 uint8_t enc_dir; \ 00015 motorEncNow[i] = MotorEncA[i]->read() | (MotorEncB[i]->read() << 1); \ 00016 enc_dir = (motorEncLast[i] & 1) ^ ((motorEncNow[i] & 2) >> 1); \ 00017 motorEncLast[i] = motorEncNow[i]; \ 00018 \ 00019 if (enc_dir & 1) motorTicks[i]++; \ 00020 else motorTicks[i]--; \ 00021 } 00022 00023 #define MOTOR_PID_TICK(i) void motor ## i ## PidTick() { \ 00024 motors[i].pid2(motorTicks[i]); \ 00025 motorTicks[i] = 0; \ 00026 } 00027 #endif
Generated on Wed Jul 13 2022 19:18:20 by
