Updated for the next revision of the motor board
Diff: MotorShield.cpp
- Revision:
- 1:4c3c2b7337a6
- Parent:
- 0:f2ede00aed8a
- Child:
- 3:2f46953e7c8b
--- a/MotorShield.cpp Mon Aug 24 20:19:03 2020 +0000 +++ b/MotorShield.cpp Tue Aug 25 23:38:26 2020 +0000 @@ -4,17 +4,24 @@ #include "mbed.h" #include "MotorShield.h" -#include "FastPWM.h" +#include "HardwareSetup.h" + +//GPIOStruct gpio; MotorShield::MotorShield(PinName forwardPin, PinName reversePin) { - - FastPWM forward(forwardPin, 1); - FastPWM reverse(reversePin, 1); + init(); } void MotorShield::init() { /** Initial config for the STM32H743 **/ + + //Init_All_HW(&gpio); // Setup PWM, ADC, GPIO + //wait_us(100); + + //TIM12->CCR2 = (PWM_ARR>>1)*(0.5f); + //TIM12->CCR1 = (PWM_ARR>>1)*(0.5f); + direction_val = 0; duty_cycle_val = 0; period_val = 10.0; @@ -38,16 +45,16 @@ void MotorShield::writePWM(){ if (direction_val == 0){ - forward.period_us(period_val); - forward.write(duty_cycle_val); - reverse.period_us(period_val); - reverse.write(0); + //forward.period_us(period_val); + //forward.write(duty_cycle_val); + //reverse.period_us(period_val); + //reverse.write(0); } else{ - reverse.period_us(period_val); - reverse.write(duty_cycle_val); - forward.period_us(period_val); - forward.write(0); + //reverse.period_us(period_val); + //reverse.write(duty_cycle_val); + //forward.period_us(period_val); + //forward.write(0); } }