1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-05-18 04:56:00 +02:00
cdf2018-principal/chef/src/premier.c
Geoffrey Frogeye 935d1054a7 Actionneurs
Partie Robotech hors-projet
2018-05-08 00:45:08 +02:00

65 lines
1.3 KiB
C

#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h> // random seed
#include <unistd.h> // sleep
#include <wiringPi.h>
#include "CA.h"
#include "CF.h"
#include "debug.h"
#include "i2c.h"
#include "ihm.h"
#include "imu.h"
#include "movement.h"
#include "position.h"
pthread_mutex_t sRunning;
void endRunning(int signal)
{
(void)signal;
pthread_mutex_unlock(&sRunning);
}
int main()
{
if (wiringPiSetup() < 0) {
fprintf(stderr, "Impossible d'initialiser WiringPi\n");
exit(EXIT_FAILURE);
}
initI2C();
srand(time(NULL));
configureDebug();
configureIHM();
configureCF();
configureCA();
configureIMU();
configurePosition();
configureMovement();
configureActionneurs();
startDebug();
startIHM();
// Bloque jusqu'à l'arrivée d'un signal
pthread_mutex_init(&sRunning, NULL);
signal(SIGINT, endRunning);
signal(SIGTERM, endRunning);
signal(SIGQUIT, endRunning);
pthread_mutex_lock(&sRunning);
pthread_mutex_lock(&sRunning);
deconfigureActionneurs();
deconfigureMovement();
deconfigurePosition();
deconfigureIMU();
deconfigureCA();
deconfigureCF();
deconfigureIHM();
deconfigureDebug();
return EXIT_SUCCESS;
}