AvrIO  1.4.5
Bibliothèque C modulaire pour ATMEL AVR
serialios.h
1 
18 #ifndef _AVRIO_SERIAL_IOS_H_
19 #define _AVRIO_SERIAL_IOS_H_
20 
21 #include <avrio/defs.h>
22 __BEGIN_C_DECLS
23 /* ========================================================================== */
24 
36 /* constants ================================================================ */
40 #define EBADBAUD (-2)
41 
46 typedef enum {
47  SERIAL_DATABIT_5 = 5,
48  SERIAL_DATABIT_6 = 6,
49  SERIAL_DATABIT_7 = 7,
50  SERIAL_DATABIT_8 = 8,
51  SERIAL_DATABIT_9 = 9,
52  SERIAL_DATABIT_UNKNOWN = -1
54 
59 typedef enum {
60  SERIAL_PARITY_NONE = 'N',
61  SERIAL_PARITY_EVEN = 'E',
62  SERIAL_PARITY_ODD = 'O',
63  SERIAL_PARITY_SPACE = 'S',
64  SERIAL_PARITY_MARK = 'M',
65  SERIAL_PARITY_UNKNOWN = -1
67 
72 typedef enum {
73  SERIAL_STOPBIT_ONE = 1,
74  SERIAL_STOPBIT_TWO = 2,
75  SERIAL_STOPBIT_ONEHALF = 3,
76  SERIAL_STOPBIT_UNKNOWN
78 
83 typedef enum {
84 
85  SERIAL_FLOW_NONE = ' ',
86  SERIAL_FLOW_RTSCTS = 'H',
87  SERIAL_FLOW_XONXOFF = 'S',
88  SERIAL_FLOW_UNKNOWN = -1
89 } eSerialFlow;
90 
91 /* constants ================================================================ */
92 #define SERIAL_BINARY 0
93 #define SERIAL_CR 0x0D
94 #define SERIAL_LF 0x0A
95 #define SERIAL_CRLF (SERIAL_CR + SERIAL_LF)
97 /* structures =============================================================== */
98 
101 typedef struct xSerialIos {
102  long baud;
107  char eol;
108 } xSerialIos;
109 
110 #define SERIAL_SETTINGS(b) { \
111  .baud = b, .dbits = SERIAL_DATABIT_8, .parity = SERIAL_PARITY_NONE, \
112  .sbits = SERIAL_STOPBIT_ONE, .flow = SERIAL_FLOW_NONE, .eol = SERIAL_CRLF }
113 
119 /* ========================================================================== */
120 __END_C_DECLS
121 #endif /* _AVRIO_SERIAL_IOS_H_ */
long baud
Definition: serialios.h:102
struct xSerialIos xSerialIos
eSerialStopBits sbits
Definition: serialios.h:105
eSerialFlow flow
Definition: serialios.h:106
char eol
Definition: serialios.h:107
eSerialFlow
Type de contrôle de flux.
Definition: serialios.h:83
eSerialParity parity
Definition: serialios.h:104
eSerialDataBits dbits
Definition: serialios.h:103
eSerialDataBits
Nombre de bits de données.
Definition: serialios.h:46
eSerialStopBits
Nombre de bits de stop.
Definition: serialios.h:72
eSerialParity
Parité
Definition: serialios.h:59