##// END OF EJS Templates
Fixed errors for windows
jeandet@PC-DE-JEANDET.lab-lpp.local -
r32:c39f76cb83ff alexis
parent child
Show More
@@ -7,7 +7,7
7 7 #define rs232noerr 0
8 8 typedef int rs232port_t;
9 9 typedef int rs232speed_t;
10 typedef enum {rs232OneStop=1,rs232One5Stop=2,rs232TwoStop=2}rs232stop;
10 typedef enum {rs232OneStop,rs232One5Stop,rs232TwoStop}rs232stop;
11 11 typedef enum {rs232parityNo,rs232parityOdd,rs232parityEven}rs232parity;
12 12
13 13
@@ -134,12 +134,18 int rs232setnbstop(rs232port_t fd, rs232
134 134 tcgetattr((int)fd, &terminos);
135 135 switch(NbStop)
136 136 {
137 case 2:
137 case rs232OneStop:
138 terminos.c_cflag &= ~CSTOPB;
139 break;
140 case rs232One5Stop:
138 141 terminos.c_cflag |= CSTOPB;
139 break;
142 break;
143 case rs232TwoStop:
144 terminos.c_cflag |= CSTOPB;
145 break;
140 146 default:
141 147 terminos.c_cflag &= ~CSTOPB;
142 break;
148 break;
143 149 }
144 150 tcsetattr((int)fd, TCSANOW, &terminos);
145 151 return 0;
@@ -45,7 +45,7 int privatedecodestop(rs232stop NbStop)
45 45 case rs232TwoStop:
46 46 return TWOSTOPBITS;
47 47 break;
48 default;
48 default:
49 49 return ONESTOPBIT;
50 50 break;
51 51 }
@@ -101,7 +101,7 rs232port_t rs232open(char* psPortName)
101 101 rs232port_t fd;
102 102 fd = (rs232port_t)CreateFile(psPortName,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
103 103 #ifdef debug
104 if(fd==INVALID_HANDLE_VALUE)
104 if(fd==(rs232port_t)INVALID_HANDLE_VALUE)
105 105 {
106 106 printf("can't open Port\n");
107 107 return (rs232port_t)badPortValue;
General Comments 0
You need to be logged in to leave comments. Login now