forked from empirefox/Stm32FirmataW5500
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathethernetConfig.h
99 lines (83 loc) · 3.35 KB
/
ethernetConfig.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*==============================================================================
* NETWORK CONFIGURATION
*
* You must configure your particular hardware. Follow the steps below.
*
* By default, StandardFirmataEthernet is configured as a TCP client.
* To configure as a TCP server, see STEP 2
*============================================================================*/
// STEP 1 [REQUIRED]
// Uncomment / comment the appropriate set of includes for your hardware (OPTION
// A or B) Option A is enabled by default.
/*
* OPTION A: Configure for Arduino Ethernet board or Arduino Ethernet shield (or
* clone)
*
* To configure StandardFirmataEthernet to use the original WIZ5100-based
* ethernet shield or Arduino Ethernet uncomment the WIZ5100_ETHERNET define
* below
*/
#define WIZ5100_ETHERNET
#ifdef WIZ5100_ETHERNET
#include <Ethernet3.h>
#include <SPI.h>
EthernetClient client;
#endif
/*
* OPTION B: Configure for Arduin Yun
*
* The Ethernet port on the Arduino Yun board can be used with Firmata in this
* configuration.
*
* To execute StandardFirmataEthernet on Yun uncomment the YUN_ETHERNET define
* below and make sure the WIZ5100_ETHERNET define (above) is commented out.
*
* On Yun there's no need to configure local_ip and mac address as this is
* automatically configured on the linux-side of Yun.
*
* Note that it may take several seconds to establish a connection with the Yun.
*/
//#define YUN_ETHERNET
#ifdef YUN_ETHERNET
#include <Bridge.h>
#include <YunClient.h>
YunClient client;
#endif
// STEP 2 [REQUIRED for all boards and shields]
// TCP Client configuration:
// To configure your board as a TCP client, set the IP address of the server you
// want to connect to. TCP Server configuration: To configure your board as a
// TCP server, comment out the following line and also ensure that remote_host
// is also commented out. #define remote_ip IPAddress(10, 0, 0, 3)
// *** REMOTE HOST IS NOT YET WORKING ***
// replace with hostname of server you want to connect to, comment out if using
// 'remote_ip' #define remote_host "server.local"
// STEP 3 [REQUIRED]
// Replace with the port that your client or server is listening on.
#define network_port 3030
// STEP 4 [REQUIRED unless using DHCP]
// Replace with your board or ethernet shield's IP address
// Comment out if you want to use DHCP
// #define local_ip IPAddress(10, 0, 0, 15)
// STEP 5 [REQUIRED]
// replace with ethernet shield mac. Must be unique for your network
static byte mac[6];
/*==============================================================================
* CONFIGURATION ERROR CHECK (don't change anything here)
*============================================================================*/
#if !defined WIZ5100_ETHERNET && !defined YUN_ETHERNET
#error \
"you must define either WIZ5100_ETHERNET or YUN_ETHERNET in ethernetConfig.h"
#endif
#if defined remote_ip && defined remote_host
#error \
"cannot define both remote_ip and remote_host at the same time in ethernetConfig.h"
#endif
/*==============================================================================
* PIN IGNORE MACROS (don't change anything here)
*============================================================================*/
#if defined(WIZ5100_ETHERNET)
// ignore SPI pins, pin 10 (Ethernet SS) and pin 4 (SS for SD-Card on Ethernet
// shield)
#define IS_IGNORE_PIN(p) ((IS_PIN_SPI(p) || (p) == PE12))
#endif