Senior design censored code to run freescale motor with X-NUCLEO-IM07M1. REFACTORED

Dependencies:   mbed

Fork of Blue_Board_Test_2 by Brad VanderWilp

Files at this revision

API Documentation at this revision

Comitter:
vicyap
Date:
Thu Apr 07 23:29:27 2016 +0000
Parent:
6:f9aca07dbdb4
Commit message:
Deleted comments

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f9aca07dbdb4 -r b8ef1960498e main.cpp
--- a/main.cpp	Thu Apr 07 23:27:18 2016 +0000
+++ b/main.cpp	Thu Apr 07 23:29:27 2016 +0000
@@ -59,74 +59,55 @@
 
 void Crise()    //state1, A0 B- C+
 {   
-//    phaseAEN = 0;
-//    phaseBEN = 1;
-    
     phaseA.write(0);
     phaseB.write(0);
     phaseC.write(pwmDuty);
-//    phaseCEN = 1;
 
     SixStep::Enable_CH1_CH2_Disable_CH3(phaseBEN, phaseCEN, phaseAEN);
 }
 
 void Bfall()    //state2, A+ B- C0
 {
-//    phaseCEN = 0;
     phaseA.write(pwmDuty);
     phaseB.write(0);
     phaseC.write(0);
-//  phaseAEN = 1;
-//    
-//    phaseBEN = 1;
+
     SixStep::Enable_CH1_CH2_Disable_CH3(phaseAEN, phaseBEN, phaseCEN);
 }
 
 void Arise()    //state3, A+ B0 C-
-{
-//    phaseBEN = 0;
-//    phaseCEN = 1;
-    
+{   
     phaseA.write(pwmDuty);
     phaseB.write(0);
     phaseC.write(0);
-//    phaseAEN = 1;
+
     SixStep::Enable_CH1_CH2_Disable_CH3(phaseAEN, phaseCEN, phaseBEN);
 }
 
 void Cfall()    //state4, A0 B+ C-
 {
-//    phaseAEN = 0;
     phaseA.write(0);
     phaseB.write(pwmDuty);
     phaseC.write(0);
-//    phaseBEN = 1;
-    
-//    phaseCEN = 1;
+
     SixStep::Enable_CH1_CH2_Disable_CH3(phaseBEN, phaseCEN, phaseAEN);
 }
 
 void Brise()    //state5, A- B+ C0
 {
-//    phaseCEN = 0;
-//    phaseAEN = 1;
-    
     phaseA.write(0);
     phaseB.write(pwmDuty);
     phaseC.write(0);
-//    phaseBEN = 1;
+
     SixStep::Enable_CH1_CH2_Disable_CH3(phaseAEN, phaseBEN, phaseCEN);
 }
 
 void Afall()    //state5, A- B0 C+
 {
-//    phaseBEN = 0;
     phaseA.write(0);
     phaseB.write(0);
     phaseC.write(pwmDuty);
-//    phaseCEN = 1;
-    
-//    phaseAEN = 1;
+
     SixStep::Enable_CH1_CH2_Disable_CH3(phaseAEN, phaseCEN, phaseBEN);
 }
 
@@ -194,49 +175,6 @@
     }
 }
 
-//int count = 0;
-//void intcall(){
-//    count = (count + 1) % 6;
-//    
-//    if(count == 0)  //B+, C-
-//    {
-//        phaseAEN = 0;
-//        phaseA.write(0);
-//        phaseB.write(pwmDuty);
-//        phaseBEN = 1;
-//    }
-//    else if(count == 1) //B+, A-
-//    {
-//        phaseCEN = 0;
-//        phaseAEN = 1;
-//    }
-//    else if(count == 2) //C+, A-
-//    {
-//        phaseBEN = 0;
-//        phaseB.write(0);
-//        phaseC.write(pwmDuty);
-//        phaseCEN = 1;
-//    }
-//    else if(count == 3) //C+, B-
-//    {
-//        phaseAEN = 0;
-//        phaseBEN = 1;
-//    }
-//    else if(count == 4) //A+, B-
-//    {
-//        phaseCEN = 0;
-//        phaseC.write(0);
-//        phaseA.write(pwmDuty);
-//        phaseAEN = 1;
-//    }
-//    else if(count == 5) //A+, C-
-//    {
-//        phaseBEN = 0;
-//        phaseCEN = 1;
-//    }
-//}
-
-
 int main() {     
     //wait until button push to start
     button.rise(&activate);
@@ -244,48 +182,12 @@
         led = !led;
         wait(1);
     }
-
-//    //startup with open loop
-//    phaseA.period_us(10);
-//    phaseB.period_us(10);
-//    phaseC.period_us(10);
-//    interrupt.attach(&intcall, .01);
-//
-//    
-//    phaseA.write(0);
-//    phaseB.write(pwmDuty);
-//    phaseC.write(0);    
-//    
-//    phaseAEN = 0;
-//    phaseBEN = 1;
-//    phaseCEN = 1;
-//    
-//    for(int i = 0; i < 4; i++)
-//    {
-//        i++;
-//        led = !led;
-//        wait(0.5);
-//    }
-//    interrupt.detach();
-    
+        
     Init();
-    
     StartUp();
-     
-//    float ADCSum = 0;
-//    int ADCCount = 0;
     
     while(1) {
         led = !led;
-        //ADCSum += pot.read();
-//        ADCCount++;
-//        if(ADCCount == 20)
-//        {
-//            pwmDuty = (ADCSum/20) * PWM_MAX;
-//            ADCSum = 0;
-//            ADCCount = 0;
-//        }
-//        pwmDuty = pot.read() * 0.7;
         pwmDuty = pot.buffered_read() * PWM_MAX;
         wait(0.05);
     }