9#ifndef INC_CONTROLLER_TASK_H_
10#define INC_CONTROLLER_TASK_H_
15#include "stm32f4xx_hal.h"
void controller_task_state_1_pos(ControllerTask *controller_task)
Executes the position control logic (State 1).
Definition controller_task.c:70
void controller_task_state_0_init(ControllerTask *controller_task)
Initializes the controller task (State 0).
Definition controller_task.c:50
void(* controller_fcn_t)(ControllerTask *controller_task)
Function pointer type for controller task state functions.
Definition controller_task.h:29
void controller_task_run(ControllerTask *controller_task)
Executes the current state of the controller task.
Definition controller_task.c:29
Header file for encoder structure and read/setup functions.
Header file for motor control structure and interface functions.
Structure that defines the controller task.
Definition controller_task.h:38
int32_t num_states
Definition controller_task.h:41
TIM_HandleTypeDef * htim_encoder
Definition controller_task.h:53
uint32_t chan2
Definition controller_task.h:43
uint32_t chan1
Definition controller_task.h:42
TIM_HandleTypeDef * htim_dt
Definition controller_task.h:54
float prev_error
Definition controller_task.h:59
int32_t dir
Definition controller_task.h:39
controller_fcn_t state_list[]
Definition controller_task.h:61
uint32_t prev_time
Definition controller_task.h:46
encoder_t * encoder
Definition controller_task.h:57
float k_p
Definition controller_task.h:49
motor_t * motor
Definition controller_task.h:56
int32_t des_pos
Definition controller_task.h:45
int32_t integral_error
Definition controller_task.h:52
float k_i
Definition controller_task.h:50
uint32_t current_time
Definition controller_task.h:47
uint32_t prev_ticks
Definition controller_task.h:48
int32_t pot_zero
Definition controller_task.h:44
uint32_t adc_val
Definition controller_task.h:51
int32_t state
Definition controller_task.h:40
ADC_HandleTypeDef * hadc
Definition controller_task.h:55
Structure to hold encoder task configuration and state.
Definition encoder_driver.h:22
Motor object data structure.
Definition motor_driver.h:22