fdserial library  v0.85
Functions for connecting with full duplex serial devices
fdserial.h
Go to the documentation of this file.
1 
32 #ifndef __FDSerial_H
33 #define __FDSerial_H
34 
35 #include "simpletext.h"
36 
37 #ifdef __cplusplus
38 extern "C"
39 {
40 #endif
41 
42 typedef text_t fdserial;
43 
47 #define FDSERIAL_BUFF_MASK 0x3f
48 
52 #define FDSERIAL_MODE_NONE 0
53 
57 #define FDSERIAL_MODE_INVERT_RX 1
58 
62 #define FDSERIAL_MODE_INVERT_TX 2
63 
68 #define FDSERIAL_MODE_OPENDRAIN_TX 4
69 
73 #define FDSERIAL_MODE_IGNORE_TX_ECHO 8
74 
78 typedef struct fdserial_struct
79 {
80  int rx_head; /* receive buffer head */
81  int rx_tail; /* receive buffer tail */
82  int tx_head; /* transmit buffer head */
83  int tx_tail; /* transmit buffer tail */
84  int rx_pin; /* recieve pin */
85  int tx_pin; /* transmit pin */
86  int mode; /* interface mode */
87  int ticks; /* clkfreq / baud */
88  char *buffptr; /* pointer to rx buffer */
89 } fdserial_st;
90 
111 fdserial *fdserial_open(int rxpin, int txpin, int mode, int baudrate);
112 
118 void fdserial_close(fdserial *term);
119 
129 int fdserial_rxCheck(fdserial *term);
130 
136 void fdserial_rxFlush(fdserial *term);
137 
146 int fdserial_rxReady(fdserial *term);
147 
158 int fdserial_rxTime(fdserial *term, int ms);
159 
168 int fdserial_rxChar(fdserial *term);
169 
180 int fdserial_txChar(fdserial *term, int txbyte);
181 
189 int fdserial_txEmpty(fdserial *term);
190 
194 void fdserial_txFlush(fdserial *term);
195 
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif
201 /* __FDSerial_H */
202 
203