Avoid to use reserved identifiers for header names (closes #157)
[libmodbus.git] / src / modbus-rtu.h
blobce7619da9da7ee5800ae64344966e4afdd7917f4
1 /*
2 * Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef MODBUS_RTU_H
20 #define MODBUS_RTU_H
22 #include "modbus.h"
24 MODBUS_BEGIN_DECLS
26 /* Modbus_Application_Protocol_V1_1b.pdf Chapter 4 Section 1 Page 5
27 * RS232 / RS485 ADU = 253 bytes + slave (1 byte) + CRC (2 bytes) = 256 bytes
29 #define MODBUS_RTU_MAX_ADU_LENGTH 256
31 MODBUS_API modbus_t* modbus_new_rtu(const char *device, int baud, char parity,
32 int data_bit, int stop_bit);
34 #define MODBUS_RTU_RS232 0
35 #define MODBUS_RTU_RS485 1
37 MODBUS_API int modbus_rtu_set_serial_mode(modbus_t *ctx, int mode);
38 MODBUS_API int modbus_rtu_get_serial_mode(modbus_t *ctx);
40 #define MODBUS_RTU_RTS_NONE 0
41 #define MODBUS_RTU_RTS_UP 1
42 #define MODBUS_RTU_RTS_DOWN 2
44 MODBUS_API int modbus_rtu_set_rts(modbus_t *ctx, int mode);
45 MODBUS_API int modbus_rtu_get_rts(modbus_t *ctx);
47 MODBUS_END_DECLS
49 #endif /* MODBUS_RTU_H */