1
Dependencies: mbed-dev-f303 FastPWM3
Diff: Calibration/calibration.cpp
- Revision:
- 24:58c2d7571207
- Parent:
- 23:2adf23ee0305
- Child:
- 25:f5741040c4bb
--- a/Calibration/calibration.cpp Wed Apr 05 20:54:16 2017 +0000 +++ b/Calibration/calibration.cpp Fri Apr 07 16:23:39 2017 +0000 @@ -62,7 +62,6 @@ printf("Direction: %d\n\r", direction); if(direction){printf("Phasing correct\n\r");} else if(!direction){printf("Phasing incorrect. Swapping phases V and W\n\r");} - gpio->phasing = direction; PHASE_ORDER = direction; } @@ -92,7 +91,7 @@ svm(1.0, v_u, v_v, v_w, &dtc_u, &dtc_v, &dtc_w); // space vector modulation for(int i = 0; i<40000; i++){ TIM1->CCR3 = 0x708*(1.0f-dtc_u); // Set duty cycles - if(gpio->phasing){ + if(PHASE_ORDER){ TIM1->CCR2 = 0x708*(1.0f-dtc_v); TIM1->CCR1 = 0x708*(1.0f-dtc_w); } @@ -114,7 +113,7 @@ abc(theta_ref, v_d, v_q, &v_u, &v_v, &v_w); // inverse dq0 transform on voltages svm(1.0, v_u, v_v, v_w, &dtc_u, &dtc_v, &dtc_w); // space vector modulation TIM1->CCR3 = 0x708*(1.0f-dtc_u); - if(gpio->phasing){ + if(PHASE_ORDER){ TIM1->CCR2 = 0x708*(1.0f-dtc_v); TIM1->CCR1 = 0x708*(1.0f-dtc_w); } @@ -139,7 +138,7 @@ abc(theta_ref, v_d, v_q, &v_u, &v_v, &v_w); // inverse dq0 transform on voltages svm(1.0, v_u, v_v, v_w, &dtc_u, &dtc_v, &dtc_w); // space vector modulation TIM1->CCR3 = 0x708*(1.0f-dtc_u); - if(gpio->phasing){ + if(PHASE_ORDER){ TIM1->CCR2 = 0x708*(1.0f-dtc_v); TIM1->CCR1 = 0x708*(1.0f-dtc_w); }