##// END OF EJS Templates
Now totaly stable on linux read timeout = 100ms
Now totaly stable on linux read timeout = 100ms

File last commit:

r11:8c2d8af9e068 alexis
r13:b220a9e23d54 alexis
Show More
RS232.h
37 lines | 1.5 KiB | text/x-c | CLexer
Use Autotools and libtools now /!\ unstable, Win port not ready
r3 // SOPSUYSI_RS232.h
yannic
Improved linux support
r11
#define debug
yannic
Included Config file for setup.
r7 #include "rs232config.h"
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
fixed some read bugs (under windows)
r8
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Win/Unix portability completed, need to be tested.
r5 #ifdef HAVE_WINDOWS_H
#include <windows.h>
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
fixed some read bugs (under windows)
r8 #define badPortValue INVALID_HANDLE_VALUE
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Win/Unix portability completed, need to be tested.
r5 typedef HANDLE rs232port_t;
typedef DWORD rs232speed_t;
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
fixed some read bugs (under windows)
r8 typedef enum {rs232OneStop=ONESTOPBIT,rs232One5Stop=ONE5STOPBITS,rs232TwoStop=TWOSTOPBITS}rs232stop;
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Win/Unix portability completed, need to be tested.
r5 typedef enum {rs232parityNo=NOPARITY,rs232parityOdd=ODDPARITY,rs232parityEven=EVENPARITY}rs232parity;
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
fixed some read bugs (under windows)
r8 #else
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#define badPortValue -1
typedef int rs232port_t;
typedef speed_t rs232speed_t;
typedef enum {rs232OneStop=1,rs232One5Stop=2,rs232TwoStop=2}rs232stop;
typedef enum {rs232parityNo=(~PARENB),rs232parityOdd=(PARENB|PARODD),rs232parityEven=(PARENB|~PARODD)}rs232parity;
#endif
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
Win/Unix portability completed, need to be tested.
r5 #endif
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
fixed some read bugs (under windows)
r8 #ifdef __cplusplus
#define rs232extern extern "C"
#else
#define rs232extern extern
#endif
rs232extern rs232port_t rs232open(char* psPortName);
rs232extern int rs232close(rs232port_t fd);
rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop);
rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize);
rs232extern int rs232read(rs232port_t fd,char *psRead, int ReadBufferSize);
rs232extern int rs232setparity(rs232port_t fd, rs232parity Parity);
rs232extern int rs232setnbstop(rs232port_t fd, rs232stop NbStop);
rs232extern int rs232setcsize(rs232port_t fd, int ChSize);
rs232extern int rs232setbaudrate(rs232port_t fd, int baudrate);