forked from khoih-prog/WebSockets2_Generic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defines.h
128 lines (111 loc) · 4.32 KB
/
defines.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/****************************************************************************************************************************
defines.h
For STM32F/L/H/G/WB/MP1 with Ethernet module/shield.
Based on and modified from Gil Maimon's ArduinoWebsockets library https://github.com/gilmaimon/ArduinoWebsockets
to support STM32F/L/H/G/WB/MP1, nRF52 and SAMD21/SAMD51 boards besides ESP8266 and ESP32
The library provides simple and easy interface for websockets (Client and Server).
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
*****************************************************************************************************************************/
#ifndef defines_h
#define defines_h
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) )
#if defined(WEBSOCKETS_ETHERNET_USE_STM32)
#undef WEBSOCKETS_ETHERNET_USE_STM32
#endif
#define WEBSOCKETS_USE_ETHERNET true
#define WEBSOCKETS_ETHERNET_USE_STM32 true
#else
#error This code is intended to run only on the STM32F/L/H/G/WB/MP1 boards ! Please check your Tools->Board setting.
#endif
#if defined(WEBSOCKETS_ETHERNET_USE_STM32)
// For STM32
#if defined(STM32F0)
#define BOARD_TYPE "STM32F0"
#error Board STM32F0 not supported
#elif defined(STM32F1)
#define BOARD_TYPE "STM32F1"
#elif defined(STM32F2)
#define BOARD_TYPE "STM32F2"
#elif defined(STM32F3)
#define BOARD_TYPE "STM32F3"
#elif defined(STM32F4)
#define BOARD_TYPE "STM32F4"
#elif defined(STM32F7)
#define BOARD_TYPE "STM32F7"
#elif defined(STM32L0)
#define BOARD_TYPE "STM32L0"
#elif defined(STM32L1)
#define BOARD_TYPE "STM32L1"
#elif defined(STM32L4)
#define BOARD_TYPE "STM32L4"
#elif defined(STM32H7)
#define BOARD_TYPE "STM32H7"
#elif defined(STM32G0)
#define BOARD_TYPE "STM32G0"
#elif defined(STM32G4)
#define BOARD_TYPE "STM32G4"
#elif defined(STM32WB)
#define BOARD_TYPE "STM32WB"
#elif defined(STM32MP1)
#define BOARD_TYPE "STM32MP1"
#else
#warning STM32 unknown board selected
#define BOARD_TYPE "STM32 Unknown"
#endif
#endif
#if defined(ARDUINO_BOARD)
#define BOARD_NAME ARDUINO_BOARD
#else
#ifndef BOARD_NAME
#define BOARD_NAME BOARD_TYPE
#endif
#endif
// Just select one to be true. If all is false, default is Ethernet.
// If more than one are true, the priority is USE_ETHERNET, USE_ETHERNET2, USE_ETHERNET_LARGE, USE_UIP_ETHERNET
#define USE_ETHERNET false
#define USE_ETHERNET2 false
#define USE_ETHERNET_LARGE true
#define USE_ETHERNET_ENC false
#define USE_UIP_ETHERNET false
#define USE_LAN8742A_ETHERNET false
#if USE_ETHERNET
// Also default to Ethernet library
#include <Ethernet.h>
#define ETHERNET_TYPE "W5x00 and Ethernet Library"
#elif USE_ETHERNET2
#include <Ethernet2.h>
#define ETHERNET_TYPE "W5x00 and Ethernet2 Library"
#elif USE_ETHERNET_LARGE
#include <EthernetLarge.h>
#define ETHERNET_TYPE "W5x00 and EthernetLarge Library"
#elif USE_ETHERNET_ENC
#include <EthernetENC.h>
#define ETHERNET_TYPE "ENC28J60 and EthernetENC Library"
#elif USE_UIP_ETHERNET
#include <UIPEthernet.h>
#include <utility/logging.h>
#define ETHERNET_TYPE "ENC28J60 and UIPEthernet Library"
#elif USE_LAN8742A_ETHERNET
#define USE_BUILTIN_ETHERNET true
#include <LwIP.h>
#include <STM32Ethernet.h>
#define ETHERNET_TYPE "LAN8742A and STM32Ethernet Library"
#else
// Default to Ethernet library
#include <Ethernet.h>
#define ETHERNET_TYPE "W5x00 and Ethernet Library"
#endif
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN 10 // For other boards
#endif
#define DEBUG_WEBSOCKETS_PORT Serial
// Debug Level from 0 to 4
#define _WEBSOCKETS_LOGLEVEL_ 3
uint8_t mac[6] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x32, 0x04 };
// Select the IP address according to your local network
IPAddress serverIP(192, 168, 2, 95);
#define SDCARD_CS 4
#endif //defines_h