Skip to content

Commit 363bfe0

Browse files
committed
Functional TCP on Arduino
1 parent 1ff8a4e commit 363bfe0

File tree

3 files changed

+169
-0
lines changed

3 files changed

+169
-0
lines changed

src/libmodbus/modbus-tcp-private.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
#ifndef MODBUS_TCP_PRIVATE_H
88
#define MODBUS_TCP_PRIVATE_H
99

10+
#ifdef ARDUINO
11+
#include <Arduino.h>
12+
#include <IPAddress.h>
13+
#include <Client.h>
14+
#endif
15+
1016
#define _MODBUS_TCP_HEADER_LENGTH 7
1117
#define _MODBUS_TCP_PRESET_REQ_LENGTH 12
1218
#define _MODBUS_TCP_PRESET_RSP_LENGTH 8
@@ -23,8 +29,13 @@ typedef struct _modbus_tcp {
2329
uint16_t t_id;
2430
/* TCP port */
2531
int port;
32+
#ifdef ARDUINO
33+
IPAddress ip;
34+
Client* client;
35+
#else
2636
/* IP address */
2737
char ip[16];
38+
#endif
2839
} modbus_tcp_t;
2940

3041
#define _MODBUS_TCP_PI_NODE_LENGTH 1025

0 commit comments

Comments
 (0)