@@ -1,7 +1,7 | |||||
1 | // SOPSUYSI_RS232.h |
|
1 | // SOPSUYSI_RS232.h | |
2 | #ifndef RS232_H |
|
2 | #ifndef RS232_H | |
3 | #define RS232_H |
|
3 | #define RS232_H | |
4 | #define debug |
|
4 | #define RS232_debug | |
5 |
|
5 | |||
6 | #define badPortValue -1 |
|
6 | #define badPortValue -1 | |
7 | #define rs232noerr 0 |
|
7 | #define rs232noerr 0 |
@@ -30,7 +30,7 rs232port_t rs232open(char* psPortName) | |||||
30 | fd = (rs232port_t)open(psPortName, O_RDWR | O_NOCTTY );//| O_NDELAY); |
|
30 | fd = (rs232port_t)open(psPortName, O_RDWR | O_NOCTTY );//| O_NDELAY); | |
31 | //fcntl((int)fd, F_SETFL, FNDELAY); |
|
31 | //fcntl((int)fd, F_SETFL, FNDELAY); | |
32 | //fd = open(psPortName, O_RDWR | O_NOCTTY); |
|
32 | //fd = open(psPortName, O_RDWR | O_NOCTTY); | |
33 | #ifdef debug |
|
33 | #ifdef RS232_debug | |
34 | if(fd==-1)printf("can't open Port\n"); |
|
34 | if(fd==-1)printf("can't open Port\n"); | |
35 | #else |
|
35 | #else | |
36 | if(fd!=-1) |
|
36 | if(fd!=-1) | |
@@ -149,7 +149,7 int rs232setup(rs232port_t fd, int ChSiz | |||||
149 | terminos.c_cc[VMIN]=0; |
|
149 | terminos.c_cc[VMIN]=0; | |
150 | terminos.c_cc[VTIME]=1; |
|
150 | terminos.c_cc[VTIME]=1; | |
151 | tcflush(fd, TCIFLUSH); |
|
151 | tcflush(fd, TCIFLUSH); | |
152 | #ifdef debug |
|
152 | #ifdef RS232_debug | |
153 | if(tcsetattr(fd, TCSANOW, &terminos)!=0)printf("bad setup\n"); |
|
153 | if(tcsetattr(fd, TCSANOW, &terminos)!=0)printf("bad setup\n"); | |
154 | #else |
|
154 | #else | |
155 | tcsetattr(fd, TCSANOW, &terminos); |
|
155 | tcsetattr(fd, TCSANOW, &terminos); |
@@ -101,7 +101,7 rs232port_t rs232open(char* psPortName) | |||||
101 | { |
|
101 | { | |
102 | rs232port_t fd; |
|
102 | rs232port_t fd; | |
103 | fd = (rs232port_t)CreateFile(psPortName,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); |
|
103 | fd = (rs232port_t)CreateFile(psPortName,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); | |
104 | #ifdef debug |
|
104 | #ifdef RS232_debug | |
105 | if(fd==(rs232port_t)INVALID_HANDLE_VALUE) |
|
105 | if(fd==(rs232port_t)INVALID_HANDLE_VALUE) | |
106 | { |
|
106 | { | |
107 | printf("can't open Port\n"); |
|
107 | printf("can't open Port\n"); |
General Comments 0
You need to be logged in to leave comments.
Login now