Rleg  2
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Macros | Functions
main.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FAILURE   -1
 Main includes. More...
 
#define SUCCESS   1
 
#define TASK1_PERIOD   100000
 

Functions

int main (void)
 
static void main_task (int signo)
 Main Periodic Task. More...
 
static void ui_task ()
 
static void control_task ()
 
static void ui_hook (int signo)
 
static void control_hook (int signo)
 
int reset_timer (void)
 
void exit_program (void)
 Internal function to end program. More...
 

Macro Definition Documentation

#define FAILURE   -1

Main includes.

Author
Rafael Lima

Definition at line 9 of file main.h.

#define SUCCESS   1

Definition at line 10 of file main.h.

Function Documentation

static void control_hook ( int  signo)
static
static void control_task ( )
static
void exit_program ( void  )

Internal function to end program.

Definition at line 180 of file main.c.

180  {
181  quittask = 1;
182  return;
183 }
int quittask
Definition: main.c:39
int main ( void  )

Definition at line 42 of file main.c.

42  {
43  int return_value = SUCCESS;
44 
45 /*Setting config values:*/
46  // Parameters for IMU
48  imu_param.acc.rate=100;
49  imu_param.acc.range=16;
50  imu_param.gyr.rate=100;
51  imu_param.gyr.lpf_bw=188;
53  imu_param.gyr.act="XYZ";
54  imu_param.mag.rate=75;
59 
60  // Parameters for SPI
61  spi_param.mode=0;
62  spi_param.speed=375000;
63  spi_param.cs=0;
64 
65  // Periodic task :
68 
69 /*Initialization:*/
71  perror("Unsuccesful devices initialization");
72  return FAILURE;
73  }
74 
75  if(ui_init()!=SUCCESS){
76  perror("Unsuccesful user interface initialization");
77  return FAILURE;
78  }
79 
80  //timer_start_task(&task1,TASK1_PERIOD);
83 
84 /* Main loop: */
85  while(quittask == 0){
86  //ui_task(0);
87  }
88 
89 /*Shutting Down:*/
92  usleep(2000);
93 
94  if(ui_close()==FAILURE){
95  return_value = FAILURE;
96  }
97 
99 
100  return return_value;
101 }
MRA_DATA_STRUCT mra_data
Definition: main.c:32
int quittask
Definition: main.c:39
struct IMU_PARAM_STRUCT::param_mag mag
static void control_task()
Definition: main.c:127
int ui_close(void)
Close UI.
Definition: ui.c:41
#define TASK_CONTROL_PERIOD
Definition: main.c:22
SPI_PARAM_STRUCT spi_param
Definition: main.c:26
#define FAILURE
Definition: calibration.h:7
IMU_PARAM_STRUCT imu_param
Definition: main.c:25
TASK_S task_control
Definition: main.c:18
void timer_stop_task(TASK_S *task)
Stop some task.
struct IMU_PARAM_STRUCT::param_gyr gyr
struct IMU_PARAM_STRUCT::param_acc acc
#define TASK_UI_PERIOD
Definition: main.c:21
static void ui_task()
Definition: main.c:118
void timer_start_task(TASK_S *task, void(*alertFunction)(int), int period_us)
Start some task.
Definition: taskScheduler.c:27
#define SUCCESS
Definition: calibration.h:6
TASK_S task_ui
Definition: main.c:18
int devices_init(IMU_PARAM_STRUCT *imu_param, SPI_PARAM_STRUCT *spi_param, MRA_DATA_STRUCT *mra_data)
INITIALIZATION OF SENSORS AND DEVICES.
Definition: communication.c:12
static void ui_hook(int signo)
Definition: main.c:108
void timer_new_task(TASK_S *task, void(*runFunction)(void))
Create a task.
Definition: taskScheduler.c:16
int ui_init(void)
Initialize UI.
Definition: ui.c:26
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.
Definition: communication.c:82
static void control_hook(int signo)
Definition: main.c:113
static void main_task ( int  signo)
static

Main Periodic Task.

Parameters
signo
int reset_timer ( void  )

Definition at line 160 of file main.c.

161 {
163  return SUCCESS;
164 }
int t0
Definition: main.c:40
TASK_S task_control
Definition: main.c:18
#define SUCCESS
Definition: calibration.h:6
volatile double t_global
Definition: taskScheduler.h:22
static void ui_hook ( int  signo)
static
static void ui_task ( )
static