Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: FOC/foc.cpp
- 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);