STM32F302R8 with Konrad's inverter boards for senior design.
Fork of Blue_Board_Ticker by
Diff: main.cpp
- Revision:
- 17:5e27edd3d8e6
- Parent:
- 16:792055c232a5
- Child:
- 18:d7033a38f20b
--- a/main.cpp Wed Apr 13 19:09:10 2016 +0000 +++ b/main.cpp Wed Apr 13 19:22:34 2016 +0000 @@ -37,60 +37,62 @@ //original names: CBA CBA, new names: BAC BAC void Brise() //state1, A0 B- C+ { + phaseA.write(0); + phaseB.write(0); + phaseC.write(pwmDuty); phaseAEN = 0; phaseBEN = 1; - - phaseC.write(pwmDuty); phaseCEN = 1; - revCount++; } void Afall() //state2, A+ B- C0 { - phaseCEN = 0; + phaseA.write(pwmDuty); + phaseB.write(0); phaseC.write(0); - phaseA.write(pwmDuty); phaseAEN = 1; - phaseBEN = 1; + phaseCEN = 0; } void Crise() //state3, A+ B0 C- { + phaseA.write(pwmDuty); + phaseB.write(0); + phaseC.write(0); + phaseAEN = 1; phaseBEN = 0; phaseCEN = 1; - - phaseA.write(pwmDuty); - phaseAEN = 1; } void Bfall() //state4, A0 B+ C- { - phaseAEN = 0; phaseA.write(0); phaseB.write(pwmDuty); + phaseC.write(0); + phaseAEN = 0; phaseBEN = 1; - phaseCEN = 1; } void Arise() //state5, A- B+ C0 { - phaseCEN = 0; + phaseA.write(0); + phaseB.write(pwmDuty); + phaseC.write(0); phaseAEN = 1; - - phaseB.write(pwmDuty); + phaseCEN = 0; phaseBEN = 1; } void Cfall() //state6, A- B0 C+ { + phaseAEN = 1; phaseBEN = 0; + phaseCEN = 1; + phaseA.write(0); phaseB.write(0); phaseC.write(pwmDuty); - phaseCEN = 1; - - phaseAEN = 1; } void toggleRedLed() @@ -141,6 +143,7 @@ } } toggleRedLed(); + revCount++; } void activate() @@ -148,7 +151,7 @@ if(stall == 0) { stall = 1; } else { - if (pwmDuty < 0.2f) + if (pwmDuty < 0.4f) { reverse = reverse ^ 1; }