21 #define TASK_UI_PERIOD 200000 //200ms
22 #define TASK_CONTROL_PERIOD 20000 //20ms
62 spi_param.
speed=375000;
71 perror(
"Unsuccesful devices initialization");
76 perror(
"Unsuccesful user interface initialization");
129 int current_datalogger_status;
150 previous_datalogger_status = current_datalogger_status;
167 int get_time(
double *time_control_task_s,
double *Ts_control_task_s,
double *mean_time_control_task_s,
double *t0_control_task_s)
169 *time_control_task_s = task1.
t_global;
170 *Ts_control_task_s = (task1.
period_us)/1e6;
172 *t0_control_task_s =
t0;
volatile double T_mean_global
static void main_task(int signo)
void timer_function_task(TASK_S *task)
volatile double T_exec_global
struct IMU_PARAM_STRUCT::param_mag mag
void actuate(int spi_dev, MRA_DATA_STRUCT *mra_data)
Applies the control signal to the actuator.
static void control_task()
int ui_close(void)
Close UI.
int datalogger_set_Ts(double Ts)
#define DATALOGGER_RUNNING
#define TASK_CONTROL_PERIOD
SPI_PARAM_STRUCT spi_param
void calibrate_all(IMU_DATA_STRUCT *imu_data)
Calibrate all sensors.
IMU_PARAM_STRUCT imu_param
int get_time(double *time_control_task_s, double *Ts_control_task_s, double *mean_time_control_task_s, double *t0_control_task_s)
Review of this function:
void timer_stop_task(TASK_S *task)
Stop some task.
struct IMU_PARAM_STRUCT::param_gyr gyr
struct IMU_PARAM_STRUCT::param_acc acc
int datalogger_update(double t_s, double t_control_exec_s, double t_ui_exec_s, double t0_s, IMU_DATA_STRUCT *pimu_data, EFF_DATA_STRUCT *peff_data, MRA_DATA_STRUCT *pmra_data)
void exit_program(void)
Internal function to end program.
void timer_start_task(TASK_S *task, void(*alertFunction)(int), int period_us)
Start some task.
#define DATALOGGER_NOT_RUNNING
int devices_init(IMU_PARAM_STRUCT *imu_param, SPI_PARAM_STRUCT *spi_param, MRA_DATA_STRUCT *mra_data)
INITIALIZATION OF SENSORS AND DEVICES.
static void ui_hook(int signo)
void timer_new_task(TASK_S *task, void(*runFunction)(void))
Create a task.
Task to schedule definition.
int read_all_data(int i2c_dev, int spi_dev, IMU_DATA_STRUCT *imu_data, EFF_DATA_STRUCT *eff_data, MRA_DATA_STRUCT *mra_data, ENC_DATA_STRUCT *enc_data)
READ ALL DATA FROM SENSORS AND ADC.
TASK_S task1
Main rotine for control:
int ui_init(void)
Initialize UI.
int devices_close(IMU_PARAM_STRUCT *imu_param, SPI_PARAM_STRUCT *spi_param, MRA_DATA_STRUCT *mra_data)
Fuction to close all communication with the sensors and devices.
int ui_update(IMU_DATA_STRUCT *pimu_data, EFF_DATA_STRUCT *peff_data, MRA_DATA_STRUCT *pmra_data, ENC_DATA_STRUCT *enc_data, int total, int failure)
Update Screen with new data of sensors.
static void control_hook(int signo)
short int v_ctl
Voltage level for control output.
int datalogger_status(void)