fdserial library
v0.85
Functions for connecting with full duplex serial devices
Main Page
Data Structures
Files
File List
Globals
fdserial.h
Go to the documentation of this file.
1
14
#ifndef __FDSerial_H
15
#define __FDSerial_H
16
17
#include "simpletext.h"
18
19
#ifdef __cplusplus
20
extern
"C"
21
{
22
#endif
23
24
typedef
text_t fdserial;
25
29
#define FDSERIAL_BUFF_MASK 0x3f
30
38
#define FDSERIAL_MODE_NONE 0
39
#define FDSERIAL_MODE_INVERT_RX 1
40
#define FDSERIAL_MODE_INVERT_TX 2
41
#define FDSERIAL_MODE_OPENDRAIN_TX 4
42
#define FDSERIAL_MODE_IGNORE_TX_ECHO 8
43
48
typedef
struct
fdserial_struct
49
{
50
int
rx_head;
/* receive queue head */
51
int
rx_tail;
/* receive queue tail */
52
int
tx_head;
/* transmit queue head */
53
int
tx_tail;
/* transmit queue tail */
54
int
rx_pin;
/* recieve pin */
55
int
tx_pin;
/* transmit pin */
56
int
mode;
/* interface mode */
57
int
ticks;
/* clkfreq / baud */
58
char
*buffptr;
/* pointer to rx buffer */
59
}
fdserial_st
;
60
69
fdserial *
fdserial_open
(
int
rxpin,
int
txpin,
int
mode,
int
baudrate);
70
74
void
fdserial_close
(fdserial *term);
75
81
int
fdserial_rxCheck
(fdserial *term);
82
86
void
fdserial_rxFlush
(fdserial *term);
87
93
int
fdserial_rxReady
(fdserial *term);
94
101
int
fdserial_rxTime
(fdserial *term,
int
ms);
102
107
int
fdserial_rxChar
(fdserial *term);
108
114
int
fdserial_txChar
(fdserial *term,
int
txbyte);
115
120
int
fdserial_txEmpty
(fdserial *term);
121
125
void
fdserial_txFlush
(fdserial *term);
126
127
#ifdef __cplusplus
128
}
129
#endif
130
131
#endif
132
/* __FDSerial_H */
133
134
/*
135
+--------------------------------------------------------------------
136
| TERMS OF USE: MIT License
137
+--------------------------------------------------------------------
138
Permission is hereby granted, free of charge, to any person obtaining
139
a copy of this software and associated documentation files
140
(the "Software"), to deal in the Software without restriction,
141
including without limitation the rights to use, copy, modify, merge,
142
publish, distribute, sublicense, and/or sell copies of the Software,
143
and to permit persons to whom the Software is furnished to do so,
144
subject to the following conditions:
145
146
The above copyright notice and this permission notice shall be
147
included in all copies or substantial portions of the Software.
148
149
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
150
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
151
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
152
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
153
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
154
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
155
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
156
+--------------------------------------------------------------------
157
*/
158
Generated on Tue Aug 6 2013 14:53:14 for fdserial library by
1.8.4