/* * File: serial.h * Author: Markcuz * * Created on 3 May 2015, 7:20 PM */ #ifndef SERIAL_H_ #define SERIAL_H_ #include // Standard input/output definitions #include // String function definitions #include // UNIX standard function definitions #include // File control definitions #include // Error number definitions #include // POSIX terminal control definitions #include #include //For boolean usage #define SERIALPATH "/dev/ttyACM0" #define USBPATH1 "/dev/ttyACM1" #define USBPATH2 "/dev/ttyACM2" #define USBPATH3 "/dev/ttyACM3" #define USBPATH4 "/dev/ttyACM4" #define TIMEOUT 20 #define DEFAULT_BAUD 115200 //char serialPortPaths[5][64] = {SERIALPATH, USBPATH1, USBPATH2, USBPATH3, USBPATH4}; int SERInit(int baud,int handshake,int interface); // Init communication (see parameters below) int SERSendChar(char ch,int interface); // Send single character int SERSend(char *buf,int interface); // Send string (Null terminated) int SERReceive(char *ch,int interface); // Receive String (Null terminated) char SERReceiveChar(int interface); // Receive single character bool SERCheck(int interface); // Non-blocking check if character is waiting int SERFlush(int interface); // Flush interface buffers int SERClose(int interface); // Close Interface int fd; //the default port #endif /* SERIAL_H */