16 #define PWMPERIOD 4000 19 #define M1H_PERIPH SYSCTL_PERIPH_GPIOM 20 #define M1H_PORT GPIO_PORTM_BASE // IF YOU CHANGE THIS PORT YOU MUST CHANGE THE INT HANDLER IN tm4c1294ncpdt_startup_css.c 21 #define M1H_PORT_INT INT_GPIOM 22 #define M1H_PIN_A GPIO_PIN_0 23 #define M1H_PIN_B GPIO_PIN_1 24 #define M1H_PIN_C GPIO_PIN_2 25 #define M1H_PINS (M1H_PIN_A | M1H_PIN_B | M1H_PIN_C) 28 #define M1_HALLSTATE_0 (M1H_PIN_A | M1H_PIN_B) 29 #define M1_HALLSTATE_1 M1H_PIN_A 30 #define M1_HALLSTATE_2 (M1H_PIN_A | M1H_PIN_C) 31 #define M1_HALLSTATE_3 M1H_PIN_C 32 #define M1_HALLSTATE_4 (M1H_PIN_B | M1H_PIN_C) 33 #define M1_HALLSTATE_5 M1H_PIN_B 36 #define M1_INL_PERIPH_A SYSCTL_PERIPH_GPIOP 37 #define M1_INL_PORT_A GPIO_PORTP_BASE 38 #define M1_INL_PIN_A GPIO_PIN_0 39 #define M1_INL_PERIPH_B SYSCTL_PERIPH_GPIOP 40 #define M1_INL_PORT_B GPIO_PORTP_BASE 41 #define M1_INL_PIN_B GPIO_PIN_1 42 #define M1_INL_PERIPH_C SYSCTL_PERIPH_GPIOP 43 #define M1_INL_PORT_C GPIO_PORTP_BASE 44 #define M1_INL_PIN_C GPIO_PIN_2 47 #define M2H_PERIPH SYSCTL_PERIPH_GPION 48 #define M2H_PORT GPIO_PORTN_BASE // IF YOU CHANGE THIS PORT YOU MUST CHANGE THE INT HANDLER IN tm4c1294ncpdt_startup_css.c 49 #define M2H_PORT_INT INT_GPION 50 #define M2H_PIN_A GPIO_PIN_0 51 #define M2H_PIN_B GPIO_PIN_1 52 #define M2H_PIN_C GPIO_PIN_2 53 #define M2H_PINS (M2H_PIN_A | M2H_PIN_B | M2H_PIN_C) 56 #define M2_INL_PERIPH_A SYSCTL_PERIPH_GPIOM 57 #define M2_INL_PORT_A GPIO_PORTM_BASE 58 #define M2_INL_PIN_A GPIO_PIN_5 59 #define M2_INL_PERIPH_B SYSCTL_PERIPH_GPIOM 60 #define M2_INL_PORT_B GPIO_PORTM_BASE 61 #define M2_INL_PIN_B GPIO_PIN_6 62 #define M2_INL_PERIPH_C SYSCTL_PERIPH_GPIOM 63 #define M2_INL_PORT_C GPIO_PORTM_BASE 64 #define M2_INL_PIN_C GPIO_PIN_7 67 #define M2_HALLSTATE_0 (M2H_PIN_A | M2H_PIN_B) 68 #define M2_HALLSTATE_1 M2H_PIN_A 69 #define M2_HALLSTATE_2 (M2H_PIN_A | M2H_PIN_C) 70 #define M2_HALLSTATE_3 M2H_PIN_C 71 #define M2_HALLSTATE_4 (M2H_PIN_B | M2H_PIN_C) 72 #define M2_HALLSTATE_5 M2H_PIN_B 133 extern void motor1PWM(
int pwm1,
int pwm2,
int pwm3);
144 extern void motor2PWM(
int pwm1,
int pwm2,
int pwm3);
void pwmInit(void)
Initializes PWM.
void motorDriverInit(void)
Initializes the SPI commands to set the motor's configuration for 1x PWM mode.
Definition: Motor.c:385
int getmotor1PWM(void)
Returns the current PWM of motor 1.
Definition: Motor.c:323
void motor2Commutate(int State, int control)
Commutate motor 2 with a given pwm.
Definition: Motor.c:277
void MotorSPIinit(void)
Initializes the SPI channels for the motor drivers.
Definition: Motor.c:346
void motor1PWM(int pwm1, int pwm2, int pwm3)
Sets the PWM value to motor 1.
Definition: Motor.c:309
void motor2ControlPWM(int control)
Sets the PWM value and direction to motor 2.
Definition: Motor.c:180
void motor1Commutate(int State, int control)
Commutate motor 1 with a given pwm.
Definition: Motor.c:245
int getmotor2PWM(void)
Returns the current PWM of motor 2.
Definition: Motor.c:328
int32_t getmotor2HALLS(void)
Returns the current state of the halls for motor 2.
Definition: Motor.c:338
int32_t getmotor1HALLS(void)
Returns the current state of the halls for motor 1.
Definition: Motor.c:333
void motorInit(void)
Initializes the GPIO pins for the motor.
Definition: Motor.c:21
void M2_INL_WRITE(int a, int b, int c)
Commutation table for motor 2.
Definition: Motor.c:453
void M1_INL_WRITE(int a, int b, int c)
Commutation table for motor 1.
Definition: Motor.c:423
void motor1ControlPWM(int control)
Sets the PWM value and direction to motor 1.
Definition: Motor.c:116
void motor2PWM(int pwm1, int pwm2, int pwm3)
Sets the PWM value to motor 2.
Definition: Motor.c:316
void M2HIntHandler(void)
Hall sensor interrupt for motor 2.
Definition: Motor.c:107
void M1HIntHandler(void)
Hall sensor interrupt for motor 1.
Definition: Motor.c:98