57 lines
1.7 KiB
C
57 lines
1.7 KiB
C
#include <stdbool.h>
|
|
#include "motor_simple.h"
|
|
|
|
#include "bump.h"
|
|
#include "systick.h"
|
|
|
|
#include "inc/msp432p401r.h"
|
|
|
|
// Left motor (PH) direction connected to P5.4 (J3.29)
|
|
// Left motor (EN) PWM connected to P2.7/TA0CCP4 (J4.40)
|
|
// Left motor (nSLEEP) enable connected to P3.7 (J4.31)
|
|
|
|
// Right motor (PH) direction connected to P5.5 (J3.30)
|
|
// Right motor (EN) PWM connected to P2.6/TA0CCP3 (J4.39)
|
|
// Right motor (nSLEEP) enable connected to P3.6 (J2.11)
|
|
|
|
|
|
// Initializes the 6 GPIO output lines and puts driver to sleep
|
|
void MotorInit(void) {
|
|
// write this code
|
|
}
|
|
|
|
// Stops both motors, puts driver to sleep
|
|
void MotorStop(void) {
|
|
P2->OUT &= ~0xC0; // off
|
|
P3->OUT &= ~0xC0; // low current sleep mode
|
|
}
|
|
|
|
// Drives both motors forward at duty (100 to 9900)
|
|
// Runs for time duration, and then stops
|
|
// Stop the motors and return if any bumper switch is active
|
|
void MotorForward(uint16_t duty, uint32_t times_10ms) {
|
|
// write this code
|
|
}
|
|
|
|
// Drives both motors backward at duty (100 to 9900)
|
|
// Runs for time duration, and then stops
|
|
// Runs even if any bumper switch is active
|
|
void MotorBackward(uint16_t duty, uint32_t times_10ms) {
|
|
// write this code
|
|
}
|
|
|
|
// Drives just the left motor forward at duty (100 to 9900)
|
|
// Right motor is stopped (sleeping)
|
|
// Runs for time duration, and then stops
|
|
// Stop the motor and return if any bumper switch is active
|
|
void MotorLeft(uint16_t duty, uint32_t times_10ms) {
|
|
// write this code
|
|
}
|
|
|
|
// Drives just the right motor forward at duty (100 to 9900)
|
|
// Left motor is stopped (sleeping)
|
|
// Runs for time duration, and then stops
|
|
// Stop the motor and return if any bumper switch is active
|
|
void MotorRight(uint16_t duty, uint32_t times_10ms) {
|
|
// write this code
|
|
} |