@@ -140,7 +140,6 LIPO = @LIPO@ | |||||
140 | LN_S = @LN_S@ |
|
140 | LN_S = @LN_S@ | |
141 | LTLIBOBJS = @LTLIBOBJS@ |
|
141 | LTLIBOBJS = @LTLIBOBJS@ | |
142 | MAKEINFO = @MAKEINFO@ |
|
142 | MAKEINFO = @MAKEINFO@ | |
143 | MANIFEST_TOOL = @MANIFEST_TOOL@ |
|
|||
144 | MKDIR_P = @MKDIR_P@ |
|
143 | MKDIR_P = @MKDIR_P@ | |
145 | NM = @NM@ |
|
144 | NM = @NM@ | |
146 | NMEDIT = @NMEDIT@ |
|
145 | NMEDIT = @NMEDIT@ | |
@@ -168,7 +167,6 abs_builddir = @abs_builddir@ | |||||
168 | abs_srcdir = @abs_srcdir@ |
|
167 | abs_srcdir = @abs_srcdir@ | |
169 | abs_top_builddir = @abs_top_builddir@ |
|
168 | abs_top_builddir = @abs_top_builddir@ | |
170 | abs_top_srcdir = @abs_top_srcdir@ |
|
169 | abs_top_srcdir = @abs_top_srcdir@ | |
171 | ac_ct_AR = @ac_ct_AR@ |
|
|||
172 | ac_ct_CC = @ac_ct_CC@ |
|
170 | ac_ct_CC = @ac_ct_CC@ | |
173 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ |
|
171 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | |
174 | am__include = @am__include@ |
|
172 | am__include = @am__include@ | |
@@ -201,6 +199,7 libdir = @libdir@ | |||||
201 | libexecdir = @libexecdir@ |
|
199 | libexecdir = @libexecdir@ | |
202 | localedir = @localedir@ |
|
200 | localedir = @localedir@ | |
203 | localstatedir = @localstatedir@ |
|
201 | localstatedir = @localstatedir@ | |
|
202 | lt_ECHO = @lt_ECHO@ | |||
204 | mandir = @mandir@ |
|
203 | mandir = @mandir@ | |
205 | mkdir_p = @mkdir_p@ |
|
204 | mkdir_p = @mkdir_p@ | |
206 | oldincludedir = @oldincludedir@ |
|
205 | oldincludedir = @oldincludedir@ |
@@ -1,4 +1,7 | |||||
1 | // SOPSUYSI_RS232.h |
|
1 | // SOPSUYSI_RS232.h | |
|
2 | ||||
|
3 | #define debug | |||
|
4 | ||||
2 | #include "rs232config.h" |
|
5 | #include "rs232config.h" | |
3 |
|
6 | |||
4 | #ifdef HAVE_WINDOWS_H |
|
7 | #ifdef HAVE_WINDOWS_H |
@@ -18,6 +18,9 rs232port_t rs232open(char* psPortName) | |||||
18 | { |
|
18 | { | |
19 | rs232port_t fd; |
|
19 | rs232port_t fd; | |
20 | fd = open(psPortName, O_RDWR | O_NOCTTY | O_NDELAY); |
|
20 | fd = open(psPortName, O_RDWR | O_NOCTTY | O_NDELAY); | |
|
21 | #ifdef debug | |||
|
22 | if(fd==-1)printf("can't open Port\n"); | |||
|
23 | #endif | |||
21 | return fd; |
|
24 | return fd; | |
22 | } |
|
25 | } | |
23 |
|
26 | |||
@@ -51,7 +54,12 int rs232setup(rs232port_t fd, int ChSiz | |||||
51 | rs232cfparity(fd, &terminos, Parity); |
|
54 | rs232cfparity(fd, &terminos, Parity); | |
52 | rs232cfnbstop(fd, &terminos, NbStop); |
|
55 | rs232cfnbstop(fd, &terminos, NbStop); | |
53 | rs232cfcsize(fd, &terminos, ChSize); |
|
56 | rs232cfcsize(fd, &terminos, ChSize); | |
54 | tcsetattr(fd, TCSANOW, &terminos); |
|
57 | ||
|
58 | #ifdef debug | |||
|
59 | if(tcsetattr(fd, TCSANOW, &terminos)!=0)printf("bad setup\n"); | |||
|
60 | #else | |||
|
61 | tcsetattr(fd, TCSANOW, &terminos); | |||
|
62 | #endif | |||
55 | return 0; |
|
63 | return 0; | |
56 | } |
|
64 | } | |
57 | } |
|
65 | } | |
@@ -83,7 +91,23 int rs232setparity(rs232port_t fd, rs232 | |||||
83 | { |
|
91 | { | |
84 | struct termios terminos; |
|
92 | struct termios terminos; | |
85 | tcgetattr(fd, &terminos); |
|
93 | tcgetattr(fd, &terminos); | |
86 | terminos.c_cflag = Parity; |
|
94 | switch(Parity) | |
|
95 | { | |||
|
96 | case rs232parityNo: | |||
|
97 | terminos.c_cflag &= Parity; | |||
|
98 | break; | |||
|
99 | case rs232parityOdd: | |||
|
100 | terminos.c_cflag &= ~PARENB; | |||
|
101 | terminos.c_cflag |= Parity; | |||
|
102 | break; | |||
|
103 | case rs232parityEven: | |||
|
104 | terminos.c_cflag &= ~PARENB; | |||
|
105 | terminos.c_cflag |= Parity; | |||
|
106 | break; | |||
|
107 | default: | |||
|
108 | terminos.c_cflag &= ~PARENB; | |||
|
109 | break; | |||
|
110 | } | |||
87 | tcsetattr(fd, TCSANOW, &terminos); |
|
111 | tcsetattr(fd, TCSANOW, &terminos); | |
88 | return 0; |
|
112 | return 0; | |
89 | } |
|
113 | } | |
@@ -212,7 +236,23 int rs232cfparity(int fd, struct termios | |||||
212 | } |
|
236 | } | |
213 | else |
|
237 | else | |
214 | { |
|
238 | { | |
215 |
|
|
239 | switch(Parity) | |
|
240 | { | |||
|
241 | case rs232parityNo: | |||
|
242 | terminos->c_cflag &= Parity; | |||
|
243 | break; | |||
|
244 | case rs232parityOdd: | |||
|
245 | terminos->c_cflag &= ~PARENB; | |||
|
246 | terminos->c_cflag |= Parity; | |||
|
247 | break; | |||
|
248 | case rs232parityEven: | |||
|
249 | terminos->c_cflag &= ~PARENB; | |||
|
250 | terminos->c_cflag |= Parity; | |||
|
251 | break; | |||
|
252 | default: | |||
|
253 | terminos->c_cflag &= ~PARENB; | |||
|
254 | break; | |||
|
255 | } | |||
216 | return 0; |
|
256 | return 0; | |
217 | } |
|
257 | } | |
218 | } |
|
258 | } |
General Comments 0
You need to be logged in to leave comments.
Login now