N K
/
foc-ed_in_the_bot_compact
last working
Fork of foc-ed_in_the_bot_compact by
Diff: config.h
- Revision:
- 0:bac9c3a3a6ca
- Child:
- 1:7b61790f6be9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.h Wed Mar 09 06:44:51 2016 +0000 @@ -0,0 +1,35 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define set_dtc(phase, value) phase = 1.0f - (value) + +#define PWMA PA_8 +#define PWMB PA_9 +#define PWMC PA_10 +#define EN PB_15 + +#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 +#define R_DOWN 3600.0f //ohms +#define R_BIAS 3600.0f //ohms +#define AVDD 3300.0f //mV + +#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 K_LOOP 5.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) + +#endif \ No newline at end of file