Bibliotheques TP RT  1.0
Bibliotheque de support pour TP/RT
robot.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 dimercur
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
26 #ifndef _ROBOT_H_
27 #define _ROBOT_H_
28 
29 #include <stdio.h>
30 #include <unistd.h>
31 #include <fcntl.h>
32 #include <termios.h>
33 #include <string.h>
34 #include <stdlib.h>
35 #include "definitions.h"
36 
37 #ifdef __FOR_PC__
38 #define serialPort "/dev/ttyUSB0"
39 #else
40 #define serialPort "/dev/ttyS0"
41 #endif /* __FOR_PC__ */
42 
43 typedef struct
44  {
45  char header[4];
46  char data[20];
48 
56 int open_communication_robot(const char * path=serialPort);
57 
65 
77 int send_command_to_robot(char cmd, const char * arg=NULL);
78 
79 #endif //_ROBOT_H_
int close_communication_robot(void)
Ferme la communication avec le robot.
#define serialPort
Definition: robot.h:40
Various constants used in destjil project.
int open_communication_robot(const char *path=serialPort)
Ouvre la communication avec le robot.
int send_command_to_robot(char cmd, const char *arg=NULL)
Envoi une commande au robot et attends sa réponse.