robot.h
Go to the documentation of this file.
/*
* Copyright (C) 2018 dimercur
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ROBOT_H_
#define _ROBOT_H_
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <string.h>
#include <stdlib.h>
#include "definitions.h"
#ifdef __FOR_PC__
#define serialPort "/dev/ttyUSB0"
#else
#define serialPort "/dev/ttyS0"
#endif /* __FOR_PC__ */
typedef struct
{
char header[4];
char data[20];
} MessageToRobot;
int open_communication_robot(const char * path=serialPort);
int close_communication_robot(void);
int send_command_to_robot(char cmd, const char * arg=NULL);
#endif //_ROBOT_H_
close_communication_robot
int close_communication_robot(void)
Ferme la communication avec le robot.
serialPort
#define serialPort
Definition: robot.h:40
MessageToRobot
Definition: robot.h:43
definitions.h
Various constants used in destjil project.
open_communication_robot
int open_communication_robot(const char *path=serialPort)
Ouvre la communication avec le robot.
send_command_to_robot
int send_command_to_robot(char cmd, const char *arg=NULL)
Envoi une commande au robot et attends sa réponse.