123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #ifndef _MODBUS_RTU_PRIVATE_H_
- #define _MODBUS_RTU_PRIVATE_H_
- #define _MODBUS_RTU_HEADER_LENGTH 1
- #define _MODBUS_RTU_PRESET_REQ_LENGTH 6
- #define _MODBUS_RTU_PRESET_RSP_LENGTH 2
- #define _MODBUS_RTU_CHECKSUM_LENGTH 2
- #ifdef NATIVE_WIN32
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- #define PY_BUF_SIZE 512
- struct win32_ser {
-
- HANDLE fd;
-
- uint8_t buf[PY_BUF_SIZE];
-
- DWORD n_bytes;
- };
- #endif
- typedef struct _modbus_rtu {
-
- #ifdef __APPLE_CC__
- char device[64];
- #else
- char device[16];
- #endif
-
- int baud;
-
- uint8_t data_bit;
-
- uint8_t stop_bit;
-
- char parity;
- #ifdef NATIVE_WIN32
- struct win32_ser w_ser;
- DCB old_dcb;
- #else
-
- struct termios old_tios;
- #endif
- } modbus_rtu_t;
- #endif
|