simpletext library v0.85 Compact variations of put/get write/read and print/scan for smaller program sizes

- Main Page
- Data Structures
- Files

- File List
- Globals

serial.h
1
9 #ifndef __SERIAL_H
10 #define __SERIAL_H
11
12 #include "simpletext.h"
13
14 #ifdef __cplusplus
15 extern "C"
16 {
17 #endif
18
19 /* don't allow using pins < 0 or > SERIAL_MAX_PIN */
20 #define SERIAL_MIN_PIN 0
21 #define SERIAL_MAX_PIN 31
22
23 typedef struct serial_info
24 {
25 int rx_pin;
26 int tx_pin;
27 int mode;
28 int baud;
29 int ticks;
30 } Serial_t;
31
32 /*
33 * This defines serial as a type alias to text_t
34 * Spelling is choice of Parallax education, not the author.
35 */
36 typedef text_t serial;
37
49 serial *serial_open(int rxpin, int txpin, int mode, int baudrate);
50
55 void serial_close(serial *device);
61 int serial_rxChar(serial *device);
68 int serial_txChar(serial *device, int txbyte);
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif
75 /* __SERIAL_H */
76
77 /*
78 +--------------------------------------------------------------------
79 | TERMS OF USE: MIT License
80 +--------------------------------------------------------------------
81 Permission is hereby granted, free of charge, to any person obtaining
82 a copy of this software and associated documentation files
83 (the "Software"), to deal in the Software without restriction,
84 including without limitation the rights to use, copy, modify, merge,
85 publish, distribute, sublicense, and/or sell copies of the Software,
86 and to permit persons to whom the Software is furnished to do so,
87 subject to the following conditions:
88
89 The above copyright notice and this permission notice shall be
90 included in all copies or substantial portions of the Software.
91
92 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
93 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
95 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
96 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
97 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
98 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99 +--------------------------------------------------------------------
100 */