Blame view

stack/modbus-rtu-private.h 762 Bytes
b85a3e4a   Peter M. Groen   Setting up workin...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  
  #pragma once
  
  #include <stdint.h>
  #include <termios.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
  
  typedef struct _modbus_rtu
  {
      /* Device: "/dev/ttyS0", "/dev/ttyUSB0" or "/dev/tty.USA19*" on Mac OS X. */
      char *device;
      /* Bauds: 9600, 19200, 57600, 115200, etc */
      int baud;
      /* Data bit */
      uint8_t data_bit;
      /* Stop bit */
      uint8_t stop_bit;
      /* Parity: 'N', 'O', 'E' */
      char parity;
      /* Save old termios settings */
      struct termios old_tios;
  
  #if HAVE_DECL_TIOCSRS485
      int serial_mode;
  #endif
  
      /* To handle many slaves on the same link */
      int confirmation_to_ignore;
  } modbus_rtu_t;