00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __RS232_H
00033 #define __RS232_H
00034
00035 #include <windows.h>
00036
00037 #define RS232_RX_SIZE 4096 // buffer size for reception
00038 #define RS232_TX_SIZE 4096 // buffer size for emission
00039 #define RS232_MAX_WAIT_READ 2000 // Timeout (in ms)
00040
00041 #define RS232_BAUD_RATE_110 CBR_110
00042 #define RS232_BAUD_RATE_300 CBR_300
00043 #define RS232_BAUD_RATE_600 CBR_600
00044 #define RS232_BAUD_RATE_1200 CBR_1200
00045 #define RS232_BAUD_RATE_2400 CBR_2400
00046 #define RS232_BAUD_RATE_4800 CBR_4800
00047 #define RS232_BAUD_RATE_9600 CBR_9600
00048 #define RS232_BAUD_RATE_14400 CBR_14400
00049 #define RS232_BAUD_RATE_19200 CBR_19200
00050 #define RS232_BAUD_RATE_38400 CBR_38400
00051 #define RS232_BAUD_RATE_56000 CBR_56000
00052 #define RS232_BAUD_RATE_57600 CBR_57600
00053 #define RS232_BAUD_RATE_115200 CBR_115200
00054 #define RS232_BAUD_RATE_128000 CBR_128000
00055 #define RS232_BAUD_RATE_256000 CBR_256000
00056
00057 #define RS232_PARITY_EVEN EVENPARITY
00058 #define RS232_PARITY_MARK MARKPARITY
00059 #define RS232_PARITY_NOPARITY NOPARITY
00060 #define RS232_PARITY_ODD ODDPARITY
00061 #define RS232_PARITY_SPACE SPACEPARITY
00062
00063 #define RS232_STOP_BIT_ONE ONESTOPBIT // 1 stop bit
00064 #define RS232_STOP_BIT_ONE5 ONE5STOPBITS // 1.5 stop bits
00065 #define RS232_STOP_BIT_TWO TWOSTOPBITS // 2 stop bits
00066
00067
00068 int rs232_open(char *_port, int baud_rate, int byte_size, int parity, int stop_bits);
00069
00070 int rs232_close();
00071
00072 int rs232_read(void *buffer, int size, int *_read_bytes);
00073
00074 int rs232_write(void* buffer, int size, int* _written_bytes);
00075
00076 #endif