Robot Agent  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
serialport.h
Go to the documentation of this file.
1 
11 #ifndef __SERIALPORT_H
12 #define __SERIALPORT_H
13 
14 /* -- Includes -- */
15 
16 /* -- Enumurations -- */
17 
18 /* -- Types -- */
19 
23 typedef struct s_SERIALPORT_STRUCT
24 {
25  int descriptor; //descriptor
26  char name[32]; //name
27  unsigned int baudrate; //baudrate
28 
29 } serialport_t;
30 
31 
32 /* -- Constants -- */
33 
34 
35 /* -- Function Prototypes -- */
36 serialport_t *serialport_open(const char *name); // Open serial port
37 int serialport_close(serialport_t *sps); // Close serial port
38 int serialport_config(serialport_t *sps, unsigned int baud); // Configure serial port
39 int serialport_write(serialport_t *sps, unsigned char *data, unsigned int bytes); // Write data to serial port
40 int serialport_byte(serialport_t *sps, unsigned char byte); // Write one byt to serial port
41 int serialport_flush_input(serialport_t *sps); // Flush input buffer
42 //int serialport_read(serialport_t *sps, char *data, int bytes); // Read dara from serial port
43 
44 #endif /* __SERIALPORT_H */
int serialport_flush_input(serialport_t *sps)
Definition: serialport.c:189
unsigned int baudrate
Definition: serialport.h:27
serialport_t * serialport_open(const char *name)
Definition: serialport.c:33
int serialport_write(serialport_t *sps, unsigned char *data, unsigned int bytes)
Definition: serialport.c:166
Serial Port structure.
Definition: serialport.h:23
int serialport_config(serialport_t *sps, unsigned int baud)
Definition: serialport.c:82
int serialport_close(serialport_t *sps)
Definition: serialport.c:58
int serialport_byte(serialport_t *sps, unsigned char byte)
Definition: serialport.c:178
struct s_SERIALPORT_STRUCT serialport_t
Serial Port structure.