123

Dependencies:   mbed-dev-f303 FastPWM3

Revision:
24:58c2d7571207
Parent:
23:2adf23ee0305
Child:
25:f5741040c4bb
--- a/FOC/foc.cpp	Wed Apr 05 20:54:16 2017 +0000
+++ b/FOC/foc.cpp	Fri Apr 07 16:23:39 2017 +0000
@@ -1,4 +1,4 @@
-
+#include "user_config.h"
 #include "foc.h"
 
 //#include "FastMath.h"
@@ -55,7 +55,7 @@
 void commutate(ControllerStruct *controller, GPIOStruct *gpio, float theta){
        
        controller->loop_count ++;
-       if(gpio->phasing){
+       if(PHASE_ORDER){
            controller->i_b = I_SCALE*(float)(controller->adc2_raw - controller->adc2_offset);    //Calculate phase currents from ADC readings
            controller->i_c = I_SCALE*(float)(controller->adc1_raw - controller->adc1_offset);
            }
@@ -103,7 +103,7 @@
        //gpio->pwm_v->write(1.0f-controller->dtc_v);
        //gpio->pwm_w->write(1.0f-controller->dtc_w);  
        
-       if(gpio->phasing){
+       if(PHASE_ORDER){
             TIM1->CCR3 = 0x708*(1.0f-controller->dtc_u);
             TIM1->CCR2 = 0x708*(1.0f-controller->dtc_v);
             TIM1->CCR1 = 0x708*(1.0f-controller->dtc_w);