#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <ncurses.h>
#include <time.h>
#include <sys/time.h>
#include <pthread.h>
#include <math.h>
#include "calibration.h"
#include "communication/communication.h"
#include "datalogger.h"
#include "ui.h"
#include "main2.h"
Go to the source code of this file.
Macros | |
#define | TASK1_PERIOD_US 20000 |
#define | TASK2_PERIOD_US 100000 |
Functions | |
void | f_timer_task_1 (union sigval sigval) |
void | f_timer_task_2 (union sigval sigval) |
int | main (void) |
int | periodic_task_1 (void) |
int | periodic_task_2 (void) |
void | f_timer_task_1 (union sigval sigval) |
void | f_timer_task_2 (union sigval sigval) |
void | timer_start_task_1 (void) |
void | timer_start_task_2 (void) |
void | timer_stop_task_1 (void) |
void | timer_stop_task_2 (void) |
void | timer_function_task_1 (void) |
void | timer_function_task_2 (void) |
int | reset_timer (void) |
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: More... | |
void | exit_program (void) |
Internal function to end program. More... | |
Variables | |
unsigned char | quittask =0 |
int | acquire =0 |
int | total = 0 |
int | failure = 0 |
timer_t | timer_task_1 |
volatile double | t_task_1_global = 0.0 |
volatile double | T_task_1_exec_global = 0.0 |
volatile double | T_task_1_mean_global = 0.0 |
volatile double | T_task_1_min_global = 0.0 |
volatile double | T_task_1_max_global = 0.0 |
volatile int | task_1_period_us = TASK1_PERIOD_US |
volatile int | flag_task_1_firstexecution = 1 |
volatile double | t0 = 0.0 |
timer_t | timer_task_2 |
volatile double | t_task_2_global = 0.0 |
volatile double | T_task_2_exec_global = 0.0 |
volatile double | T_task_2_mean_global = 0.0 |
volatile double | T_task_2_min_global = 0.0 |
volatile double | T_task_2_max_global = 0.0 |
volatile int | task_2_period_us = TASK2_PERIOD_US |
volatile int | flag_task_2_firstexecution = 1 |
unsigned int | telemetry_mode = UI_NCURSES_MODE |
int | buff_i =0 |
short int | buff [3][3][3] |
IMU_PARAM_STRUCT | imu_param |
SPI_PARAM_STRUCT | spi_param |
IMU_DATA_STRUCT | imu_data |
EFF_DATA_STRUCT | eff_data |
MRA_DATA_STRUCT | mra_data |
ENC_DATA_STRUCT | enc_data |
void exit_program | ( | void | ) |
Internal function to end program.
Definition at line 554 of file main2.c.
References quittask.
Referenced by ui_update().
void f_timer_task_1 | ( | union sigval | sigval | ) |
Definition at line 330 of file main2.c.
References timer_function_task_1().
Referenced by timer_start_task_1().
void f_timer_task_1 | ( | union sigval sigval | ) |
Definition at line 330 of file main2.c.
References timer_function_task_1().
Referenced by timer_start_task_1().
void f_timer_task_2 | ( | union sigval | sigval | ) |
Definition at line 336 of file main2.c.
References timer_function_task_2().
Referenced by timer_start_task_2().
void f_timer_task_2 | ( | union sigval sigval | ) |
Definition at line 336 of file main2.c.
References timer_function_task_2().
Referenced by timer_start_task_2().
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:
Definition at line 545 of file main2.c.
References TASK_S::period_us, SUCCESS, t0, TASK_S::t_global, TASK_S::T_mean_global, t_task_1_global, T_task_1_mean_global, and task_1_period_us.
int main | ( | void | ) |
Definition at line 88 of file main2.c.
References IMU_PARAM_STRUCT::acc, IMU_PARAM_STRUCT::param_gyr::act, IMU_PARAM_STRUCT::param_gyr::clk_source, control_hook(), control_task(), SPI_PARAM_STRUCT::cs, datalogger_close(), datalogger_init(), DATALOGGER_RUNNING, datalogger_status(), datalogger_stop(), DATALOGGER_SUCCESS, datalogger_write_file(), devices_close(), devices_init(), FAILURE, IMU_PARAM_STRUCT::param_acc::full_res, IMU_PARAM_STRUCT::gyr, IMU_PARAM_STRUCT::param_gyr::lpf_bw, IMU_PARAM_STRUCT::mag, IMU_PARAM_STRUCT::param_mag::meas_mode, SPI_PARAM_STRUCT::mode, IMU_PARAM_STRUCT::param_mag::op_mode, quittask, IMU_PARAM_STRUCT::param_acc::range, IMU_PARAM_STRUCT::param_mag::range, IMU_PARAM_STRUCT::param_acc::rate, IMU_PARAM_STRUCT::param_gyr::rate, IMU_PARAM_STRUCT::param_mag::rate, IMU_PARAM_STRUCT::param_mag::samples_avg, SPI_PARAM_STRUCT::speed, status, SUCCESS, TASK1_PERIOD_US, TASK2_PERIOD_US, task_1_period_us, TASK_CONTROL_PERIOD, TASK_UI_PERIOD, timer_new_task(), timer_start_task(), timer_start_task_1(), timer_start_task_2(), timer_stop_task(), timer_stop_task_1(), timer_stop_task_2(), ui_close(), ui_hook(), ui_init(), and ui_task().
int periodic_task_1 | ( | void | ) |
Definition at line 190 of file main2.c.
References actuate(), calibrate_all(), DATALOGGER_NOT_RUNNING, DATALOGGER_RUNNING, datalogger_set_Ts(), datalogger_status(), datalogger_update(), failure, IMU_PARAM_STRUCT::i2c_dev, read_all_data(), reset_timer(), SPI_PARAM_STRUCT::spi_dev, SUCCESS, t0, T_task_1_exec_global, t_task_1_global, T_task_2_exec_global, task_1_period_us, total, and MRA_DATA_STRUCT::v_ctl.
Referenced by timer_function_task_1().
int periodic_task_2 | ( | void | ) |
Definition at line 277 of file main2.c.
References IMU_DATA_STRUCT::acc, buff, buff_i, devices_init(), failure, IMU_DATA_STRUCT::gyr, IMU_PARAM_STRUCT::i2c_dev, IMU_DATA_STRUCT::mag, SPI_PARAM_STRUCT::spi_dev, SUCCESS, telemetry_mode, total, UI_NCURSES_MODE, ui_update(), DATA_XYZ::x, DATA_XYZ::y, and DATA_XYZ::z.
Referenced by timer_function_task_2().
int reset_timer | ( | void | ) |
Definition at line 539 of file main2.c.
References SUCCESS, t0, TASK_S::t_global, and t_task_1_global.
Referenced by periodic_task_1().
void timer_function_task_1 | ( | void | ) |
Definition at line 426 of file main2.c.
References flag_task_1_firstexecution, periodic_task_1(), status, t0, T_task_1_exec_global, t_task_1_global, T_task_1_max_global, T_task_1_mean_global, and T_task_1_min_global.
Referenced by f_timer_task_1().
void timer_function_task_2 | ( | void | ) |
Definition at line 483 of file main2.c.
References flag_task_2_firstexecution, periodic_task_2(), status, T_task_2_exec_global, t_task_2_global, T_task_2_max_global, T_task_2_mean_global, and T_task_2_min_global.
Referenced by f_timer_task_2().
void timer_start_task_1 | ( | void | ) |
Definition at line 342 of file main2.c.
References f_timer_task_1(), flag_task_1_firstexecution, task_1_period_us, and timer_task_1.
Referenced by main().
void timer_start_task_2 | ( | void | ) |
Definition at line 375 of file main2.c.
References f_timer_task_2(), flag_task_2_firstexecution, task_2_period_us, and timer_task_2.
Referenced by main().
void timer_stop_task_1 | ( | void | ) |
Definition at line 406 of file main2.c.
References timer_task_1.
Referenced by main().
void timer_stop_task_2 | ( | void | ) |
Definition at line 416 of file main2.c.
References timer_task_2.
Referenced by main().
short int buff[3][3][3] |
Definition at line 68 of file main2.c.
Referenced by periodic_task_2().
int buff_i =0 |
Definition at line 67 of file main2.c.
Referenced by periodic_task_2().
EFF_DATA_STRUCT eff_data |
ENC_DATA_STRUCT enc_data |
int failure = 0 |
Definition at line 42 of file main2.c.
Referenced by periodic_task_1(), and periodic_task_2().
volatile int flag_task_1_firstexecution = 1 |
Definition at line 52 of file main2.c.
Referenced by timer_function_task_1(), and timer_start_task_1().
volatile int flag_task_2_firstexecution = 1 |
Definition at line 64 of file main2.c.
Referenced by timer_function_task_2(), and timer_start_task_2().
IMU_DATA_STRUCT imu_data |
IMU_PARAM_STRUCT imu_param |
MRA_DATA_STRUCT mra_data |
unsigned char quittask =0 |
Definition at line 39 of file main2.c.
Referenced by exit_program(), main(), and threads_linux_init().
SPI_PARAM_STRUCT spi_param |
volatile double t0 = 0.0 |
Definition at line 53 of file main2.c.
Referenced by get_time(), periodic_task_1(), reset_timer(), and timer_function_task_1().
volatile double T_task_1_exec_global = 0.0 |
Definition at line 47 of file main2.c.
Referenced by periodic_task_1(), and timer_function_task_1().
volatile double t_task_1_global = 0.0 |
Definition at line 46 of file main2.c.
Referenced by get_time(), periodic_task_1(), reset_timer(), and timer_function_task_1().
volatile double T_task_1_max_global = 0.0 |
Definition at line 50 of file main2.c.
Referenced by timer_function_task_1().
volatile double T_task_1_mean_global = 0.0 |
Definition at line 48 of file main2.c.
Referenced by get_time(), and timer_function_task_1().
volatile double T_task_1_min_global = 0.0 |
Definition at line 49 of file main2.c.
Referenced by timer_function_task_1().
volatile double T_task_2_exec_global = 0.0 |
Definition at line 59 of file main2.c.
Referenced by periodic_task_1(), and timer_function_task_2().
volatile double t_task_2_global = 0.0 |
Definition at line 58 of file main2.c.
Referenced by timer_function_task_2().
volatile double T_task_2_max_global = 0.0 |
Definition at line 62 of file main2.c.
Referenced by timer_function_task_2().
volatile double T_task_2_mean_global = 0.0 |
Definition at line 60 of file main2.c.
Referenced by timer_function_task_2().
volatile double T_task_2_min_global = 0.0 |
Definition at line 61 of file main2.c.
Referenced by timer_function_task_2().
volatile int task_1_period_us = TASK1_PERIOD_US |
Definition at line 51 of file main2.c.
Referenced by get_time(), main(), periodic_task_1(), and timer_start_task_1().
volatile int task_2_period_us = TASK2_PERIOD_US |
Definition at line 63 of file main2.c.
Referenced by timer_start_task_2().
unsigned int telemetry_mode = UI_NCURSES_MODE |
Definition at line 65 of file main2.c.
Referenced by periodic_task_2().
timer_t timer_task_1 |
Definition at line 45 of file main2.c.
Referenced by timer_start_task_1(), and timer_stop_task_1().
timer_t timer_task_2 |
Definition at line 57 of file main2.c.
Referenced by timer_start_task_2(), and timer_stop_task_2().
int total = 0 |
Definition at line 41 of file main2.c.
Referenced by periodic_task_1(), and periodic_task_2().