DP

Dependencies:   FastAnalogIn mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers threads.h Source File

threads.h

00001 #ifndef _COMMON_H
00002 #define _COMMON_H
00003 
00004 
00005 #include "mbed.h"
00006 #include "rtos.h"
00007 #include "can.h"
00008 #include "ultrasonic.h"
00009 #include "ledsensor.h"
00010 #include "control.h"
00011 #include "print.h"
00012 
00013 /* PROGRAM MODES */
00014 #define WAITING  0x01
00015 #define STARTING 0x02
00016 #define RUNNING  0x03
00017 #define STOP     0x04
00018 
00019 
00020 #define ULTRA   0
00021 #define LASER   1
00022 
00023 
00024 #define PID   0
00025 #define ST_FEEDBACK   1
00026 
00027 typedef struct states_t {
00028     float phi1;
00029     float omega1;
00030     float phi2;
00031     float omega2;
00032     float current;  
00033 } states_t;
00034 
00035 
00036 
00037 extern InterruptIn butOff;
00038 
00039 extern cUltrasonic us100;
00040 extern cCan can;
00041 extern cPrint pc;
00042 extern cLedSensor baumer;
00043 extern cControl control;
00044 
00045 extern float K[4];
00046 extern char first;
00047 extern states_t states;
00048 extern Mutex mutex1;
00049 extern char  programMode;
00050 extern char stisknut;
00051 extern char sensor;
00052 extern char controller;
00053 
00054 
00055 void stopProg();
00056 
00057 
00058 /* 
00059  * Thread for inicialization
00060  */
00061 void initThread(void const *args);
00062 
00063 /*
00064  * Thread for led diodes
00065  */
00066 void ledThread(void const *args);
00067 
00068 /*
00069  * Thread for ultrasonic sensor
00070  */
00071 void usThread(void const *args);
00072 
00073 /*
00074  * Thread for baumer sensor
00075  */
00076 void laserThread(void const *args);
00077 
00078 /*
00079  * Thread for control
00080  */
00081 void controlThread(void const *args);
00082 
00083 /*
00084  * Thread for collect data
00085  */
00086 void collectThread(void const *args);
00087 
00088 /*
00089  * Thread for sending synchronization
00090  */
00091 void syncThread(void const *args);
00092 
00093 /*
00094  * Thread for print results
00095  */
00096 void printThread(void const *args);
00097 
00098 #endif