Welcome to the EyeBot  Version 7 - RPi1
A Controller For Various Hardware IO
serial.h
Go to the documentation of this file.
1 
7 #ifndef SERIAL_H_
8 #define SERIAL_H_
9 
10 #include <stdio.h> // Standard input/output definitions
11 #include <string.h> // String function definitions
12 #include <unistd.h> // UNIX standard function definitions
13 #include <fcntl.h> // File control definitions
14 #include <errno.h> // Error number definitions
15 #include <termios.h> // POSIX terminal control definitions
16 #include <time.h>
17 #include <stdbool.h> //For boolean usage
18 
19 #include "types.h"
20 #include "system.h"
21 
22 #define TIMEOUT 100
23 #define DEFAULT_BAUD 115200
24 
25 char USBPATH1[HDT_MAX_PATHCHAR];
26 char USBPATH2[HDT_MAX_PATHCHAR];
27 char USBPATH3[HDT_MAX_PATHCHAR];
28 char USBPATH4[HDT_MAX_PATHCHAR];
29 
30 int SERPathInit;
31 int SERType;
32 int SERBaud[5];
33 int SERHandshake[5];
34 
35 int SERInit(int interface, int baud,int handshake); // Init communication (see parameters below)
36 int SERSendChar(int interface, char ch); // Send single character
37 int SERSend(int interface, char *buf); // Send string (Null terminated)
38 int SERReceive(int interface, char *ch); // Receive String (Null terminated)
39 char SERReceiveChar(int interface); // Receive single character
40 bool SERCheck(int interface); // Non-blocking check if character is waiting
41 int SERFlush(int interface); // Flush interface buffers
42 int SERClose(int interface); // Close Interface
43 int SERGetPaths();
44 
45 int fd; //the default port
46 
47 
48 #endif /* SERIAL_H */
49 
Defines types used for the EyeBot 7.
int SERClose(int interface)
closes the port
Definition: serial.c:414
int SERGetPaths()
Obtains the system paths to the serial usb devices matching description in hdt.txt.
Definition: serial.c:14
int SERReceive(int interface, char *ch)
Receives a string from port handle.
Definition: serial.c:340
int SERFlush(int interface)
flushes the port
Definition: serial.c:400
bool SERCheck(int interface)
checks and flushes the port by sending enter until seeing prompt
Definition: serial.c:377
int SERSendChar(int interface, char ch)
Sends a single character to the given port handle.
Definition: serial.c:295
int SERSend(int interface, char *buf)
Sends a string to the given port handle.
Definition: serial.c:318
Header file for system functions.
int SERInit(int interface, int baud, int handshake)
Initialises the port.
Definition: serial.c:176
char SERReceiveChar(int interface)
Receives a single character from the given port handle.
Definition: serial.c:363