31 unsigned int receive_int32;
58 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
75 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
81 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
87 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
93 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
99 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
105 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
111 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
117 receive_int32 = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7];
141 nvic_priority_group_set(NVIC_PRIGROUP_PRE4_SUB0);
void encoder_zeroing(void)
correct the mechanical angle zero deviation between the magnetic encoder and FOC.
void filter_config(void)
configure low-pass filter parameters
void flash_write_parameters(void)
program all parameters to flash
void flash_read_parameters(void)
read all parameters from flash
unsigned char foc_parameter_available_flag
flag variable for FOC parameter availability
volatile FOC_Structure_t FOC_Struct
FOC handler.
void foc_calibrate_phase(void)
automatic phase sequence detection and correction
#define led_config()
configure led periph and its gpios
#define led_toggle()
flip the LED pin level
void mdtp_callback_handler(unsigned char pid, const unsigned char *data)
user callback function for unpacking completion of medium capacity transport protocol
static volatile unsigned char minifoc_fsm_state
used to indicate the current status of miniFOC
int main(void)
main function
main function Header File
volatile unsigned char pid_control_mode_flag
flag variable of PID closed loop mode
unsigned char pid_parameter_available_flag
flag variable for PID parameter availability
void pid_config(unsigned char mode)
configure pid loop parameters
volatile PID_Structure_t angle_pid_handler
algorithm handler of PID angle loop
volatile PID_Structure_t speed_pid_handler
algorithm handler of PID speed loop
#define ANGLE_LOOP_CONTROL
angle loop control mode
#define TORQUE_LOOP_CONTROL
torque loop control mode
#define SPEED_LOOP_CONTROL
speed loop control mode
void report_local_variable(void)
report PID parameters and current user settings
void report_angle_speed(void)
report angle and speed using medium capacity transport protocol
void spi_config(void)
configure spi0 periph and its gpios
float user_expect
user expect value of miniFOC
float ki
integral term coefficient in PID
float kp
proportional term coefficient in PID
float sum_maximum
maximum of anti saturation integral in PID
float expect
user expectations in PID
float kd
differential term coefficient in PID
void systick_config(void)
initialize systick timer to implementation delay function
void delayms(unsigned long count)
millisecond delay function, any time time.
float int32_to_float(unsigned int data0)
convert int32 to floating point numbers type data
void timer2_disable(void)
disable timer2 periph and timer2 interrupt
void pwm_config(void)
configure timer1 periph and its gpios
void timer13_disable(void)
disable timer13 periph and timer2 interrupt
void timer13_config(void)
configure timer13 periph for timing interrupt
void timer2_config(void)
configure timer2 periph for timing interrupt
void uart_config(void)
configure uart0 periph and its gpios