last working

Dependencies:   FastPWM3 mbed

Fork of foc-ed_in_the_bot_compact by Bayley Wang

Revision:
9:074575151e4b
Parent:
2:eabe8feaaabb
Child:
10:6829abb438fc
--- a/config.h	Fri Mar 18 12:07:14 2016 +0000
+++ b/config.h	Tue May 17 06:44:09 2016 +0000
@@ -1,7 +1,10 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-#define set_dtc(phase, value) *phase = 1.0f - (value)
+#define CPR 4096
+#define POS_OFFSET 5.3f
+#define POLE_PAIRS 3.0f
+#define RESOLVER_LOBES 3.0f
 
 #define PWMA PA_8
 #define PWMB PA_9
@@ -10,11 +13,6 @@
 
 #define IA PA_4
 #define IB PB_0
-#define TEST_DAC PA_5
-
-#define PI 3.141593f
-#define CPR 4096
-#define POS_OFFSET 5.3f
 
 #define I_SCALE_RAW 25.0f //mv/A
 #define R_UP 12000.0f //ohms
@@ -25,13 +23,16 @@
 #define I_OFFSET (AVDD * R_DOWN * R_UP / (R_DOWN * R_UP + R_BIAS * (R_DOWN + R_UP)))
 #define I_SCALE (R_BIAS * R_DOWN * I_SCALE_RAW / (R_DOWN * R_UP + R_BIAS * (R_DOWN + R_UP)))
 
+#define BUS_VOLTAGE 20.0f
 #define K_LOOP 1.0f
 #define KI_BASE 0.01f
-#define BUS_VOLTAGE 20.0f
 
 #define KP (K_LOOP / BUS_VOLTAGE)
 #define KI (KI_BASE * K_LOOP / BUS_VOLTAGE)
 
 #define INTEGRAL_MAX 1.0f
 
+#define set_dtc(phase, value) *phase = (value)
+#define PI 3.141593f
+
 #endif
\ No newline at end of file