This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
defines.h
778 lines (664 loc) · 25.5 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
/****************************************************************************************************************************
defines.h
For all Generic boards such as ESP8266, ESP32, SAM DUE, SAMD21/SAMD51, nRF52, STM32F/L/H/G/WB/MP1, AVR, megaAVR, Teensy
with WiFiNINA, ESP8266/ESP32 WiFi, ESP8266-AT, W5x00, ENC28J60, built-in Ethernet LAN8742A, WT32_ETH01
DDNS_Generic is a library to update DDNS IP address for DDNS services such as
duckdns, noip, dyndns, dynu, enom, all-inkl, selfhost.de, dyndns.it, strato, freemyip, afraid.org, ovh.com
Based on and modified from
1) EasyDDNS (https://github.com/ayushsharma82/EasyDDNS)
2) ArduinoHttpClient (https://github.com/arduino-libraries/ArduinoHttpClient)
Built by Khoi Hoang https://github.com/khoih-prog/DDNS_Generic
Licensed under MIT license
*****************************************************************************************************************************/
#ifndef defines_h
#define defines_h
#define DEBUG_WIFI_WEBSERVER_PORT Serial
// Debug Level from 0 to 4
#define _WIFI_LOGLEVEL_ 4
#define _WIFININA_LOGLEVEL_ 4
#define _DDNS_GENERIC_LOGLEVEL_ 2
// Select DDNS_USING_WIFI for boards using built-in WiFi, such as Nano-33-IoT
#define DDNS_USING_WIFI false
#define DDNS_USING_ETHERNET true
/////////////////////////////////
#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_NRF528XX)
#undef WIFI_USE_NRF528XX
#endif
#define WIFI_USE_NRF528XX true
#warning Use NRF52 architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_NRF528XX)
#undef ETHERNET_USE_NRF528XX
#endif
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define ETHERNET_USE_NRF528XX true
#warning Use NRF52 architecture with Ethernet
#endif
#endif
/////////////////////////////////
#if ( defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || defined(ARDUINO_GENERIC_RP2040) )
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_RP2040)
#undef WIFI_USE_RP2040
#endif
#define WIFI_USE_RP2040 true
#if !defined(ARDUINO_ARCH_MBED)
#warning Use RP2040 architecture with WiFi
#else
#error ARDUINO_ARCH_MBED WiFi not supported yet on the RP2040-based boards ! Please check your Tools->Board setting.
#endif
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_RP2040)
#undef ETHERNET_USE_RP2040
#endif
// Default pin 5 to SS/CS
#define USE_THIS_SS_PIN 5
#define ETHERNET_USE_RP2040 true
#if defined(ARDUINO_ARCH_MBED)
#warning Use RP2040 architecture with Ethernet
#endif
#endif
#endif
/////////////////////////////////
#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
|| defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
|| defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
|| defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_SAMD)
#undef WIFI_USE_SAMD
#endif
#define WIFI_USE_SAMD true
#warning Use SAMD architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_SAMD)
#undef ETHERNET_USE_SAMD
#endif
// For SAMD
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define ETHERNET_USE_SAMD true
#warning Use SAMD architecture with Ethernet
#endif
#endif
/////////////////////////////////
#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_SAM_DUE)
#undef WIFI_USE_SAM_DUE
#endif
#define WIFI_USE_SAM_DUE true
#warning Use SAM_DUE architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_SAM_DUE)
#undef ETHERNET_USE_SAM_DUE
#endif
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define ETHERNET_USE_SAM_DUE true
#warning Use SAM_DUE architecture with Ethernet
#endif
#endif
/////////////////////////////////
#if ( defined(__AVR_ATmega2560__) )
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_AVR)
#undef WIFI_USE_AVR
#endif
#define WIFI_USE_AVR true
#warning Use AVR architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_AVR)
#undef ETHERNET_USE_AVR
#endif
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define ETHERNET_USE_AVR true
#warning Use AVR architecture with Ethernet
#endif
#endif
#if ( defined(CORE_TEENSY) )
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_TEENSY)
#undef WIFI_USE_TEENSY
#endif
#define WIFI_USE_TEENSY true
#warning Use Teensy architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_TEENSY)
#undef ETHERNET_USE_TEENSY
#endif
#define ETHERNET_USE_TEENSY true
#warning Use Teensy architecture with Ethernet
#endif
#endif
/////////////////////////////////
#if ( defined(__AVR_ATmega4809__) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) )
// Default WiFiNINA for UNO WiFi Rev2
#if defined(ARDUINO_AVR_UNO_WIFI_REV2)
#if !(DDNS_USING_WIFI)
#undef DDNS_USING_WIFI
#define DDNS_USING_WIFI true
#endif
#if (DDNS_USING_ETHERNET)
#undef DDNS_USING_ETHERNET
#define DDNS_USING_ETHERNET false
#endif
#endif
#if (DDNS_USING_WIFI)
#if defined(WIFI_USE_MEGA_AVR)
#undef WIFI_USE_MEGA_AVR
#endif
#define WIFI_USE_MEGA_AVR true
#warning Use megaAVR architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_MEGA_AVR)
#undef ETHERNET_USE_MEGA_AVR
#endif
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define ETHERNET_USE_MEGA_AVR true
#warning Use megaAVR architecture with Ethernet
#endif
#endif
/////////////////////////////////
#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 (DDNS_USING_WIFI)
#if defined(WIFI_USE_STM32)
#undef WIFI_USE_STM32
#endif
#define WIFI_USE_STM32 true
#warning Use STM32 architecture with WiFi
#elif DDNS_USING_ETHERNET
#if defined(ETHERNET_USE_STM32)
#undef ETHERNET_USE_STM32
#endif
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define ETHERNET_USE_STM32 true
#warning Use STM32 architecture with Ethernet
#endif
#endif
/////////////////////////////////
#ifdef CORE_TEENSY
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define EspSerial Serial2 //Serial2, Pin RX2 : 7, TX2 : 8
#if defined(__IMXRT1062__)
// For Teensy 4.1/4.0
#if defined(ARDUINO_TEENSY41)
#define BOARD_TYPE "TEENSY 4.1"
// Use true for NativeEthernet Library, false if using other Ethernet libraries
#define USE_NATIVE_ETHERNET true
#elif defined(ARDUINO_TEENSY40)
#define BOARD_TYPE "TEENSY 4.0"
#else
#define BOARD_TYPE "TEENSY 4.x"
#endif
#elif defined(__MK66FX1M0__)
#define BOARD_TYPE "Teensy 3.6"
#elif defined(__MK64FX512__)
#define BOARD_TYPE "Teensy 3.5"
#elif defined(__MKL26Z64__)
#define BOARD_TYPE "Teensy LC"
#elif defined(__MK20DX256__)
#define BOARD_TYPE "Teensy 3.2" // and Teensy 3.1 (obsolete)
#elif defined(__MK20DX128__)
#define BOARD_TYPE "Teensy 3.0"
#elif defined(__AVR_AT90USB1286__)
#error Teensy 2.0++ not supported yet
#elif defined(__AVR_ATmega32U4__)
#error Teensy 2.0 not supported yet
#else
// For Other Boards
#define BOARD_TYPE "Unknown Teensy Board"
#endif
#elif defined(WIFI_USE_NRF528XX) || defined(ETHERNET_USE_NRF528XX)
// For nRF52
#define EspSerial Serial1
#if defined(NRF52840_FEATHER)
#define BOARD_TYPE "NRF52840_FEATHER_EXPRESS"
#elif defined(NRF52832_FEATHER)
#define BOARD_TYPE "NRF52832_FEATHER"
#elif defined(NRF52840_FEATHER_SENSE)
#define BOARD_TYPE "NRF52840_FEATHER_SENSE"
#elif defined(NRF52840_ITSYBITSY)
#define BOARD_TYPE "NRF52840_ITSYBITSY_EXPRESS"
#elif defined(NRF52840_CIRCUITPLAY)
#define BOARD_TYPE "NRF52840_CIRCUIT_PLAYGROUND"
#elif defined(NRF52840_CLUE)
#define BOARD_TYPE "NRF52840_CLUE"
#elif defined(NRF52840_METRO)
#define BOARD_TYPE "NRF52840_METRO_EXPRESS"
#elif defined(NRF52840_PCA10056)
#define BOARD_TYPE "NORDIC_NRF52840DK"
#elif defined(NINA_B302_ublox)
#define BOARD_TYPE "NINA_B302_ublox"
#elif defined(NINA_B112_ublox)
#define BOARD_TYPE "NINA_B112_ublox"
#elif defined(PARTICLE_XENON)
#define BOARD_TYPE "PARTICLE_XENON"
#elif defined(MDBT50Q_RX)
#define BOARD_TYPE "RAYTAC_MDBT50Q_RX"
#elif defined(ARDUINO_NRF52_ADAFRUIT)
#define BOARD_TYPE "ARDUINO_NRF52_ADAFRUIT"
#else
#define BOARD_TYPE "nRF52 Unknown"
#endif
#elif defined(WIFI_USE_RP2040) || defined(ETHERNET_USE_RP2040)
// For RP2040
#define EspSerial Serial1
// Default pin 5 (in Mbed) or 17 to SS/CS
#if defined(ARDUINO_ARCH_MBED)
// For RPI Pico using Arduino Mbed RP2040 core
// SCK: GPIO2, MOSI: GPIO3, MISO: GPIO4, SS/CS: GPIO5
#define USE_THIS_SS_PIN 17
#if defined(BOARD_NAME)
#undef BOARD_NAME
#endif
#if defined(ARDUINO_RASPBERRY_PI_PICO)
#define BOARD_TYPE "MBED RASPBERRY_PI_PICO"
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define BOARD_TYPE "MBED DAFRUIT_FEATHER_RP2040"
#elif defined(ARDUINO_GENERIC_RP2040)
#define BOARD_TYPE "MBED GENERIC_RP2040"
#else
#define BOARD_TYPE "MBED Unknown RP2040"
#endif
#else
//#define USING_SPI2 true
// For RPI Pico using E. Philhower RP2040 core
#if (USING_SPI2)
// SCK: GPIO14, MOSI: GPIO15, MISO: GPIO12, SS/CS: GPIO13 for SPI1
#define USE_THIS_SS_PIN 13
#else
// SCK: GPIO18, MOSI: GPIO19, MISO: GPIO16, SS/CS: GPIO17 for SPI0
#define USE_THIS_SS_PIN 17
#endif
#endif
#define SS_PIN_DEFAULT USE_THIS_SS_PIN
// For RPI Pico
#warning Use RPI-Pico RP2040 architecture
#elif defined(WIFI_USE_SAMD) || defined(ETHERNET_USE_SAMD)
// For SAMD
#define EspSerial Serial1
#if ( defined(ARDUINO_SAMD_ZERO) && !defined(SEEED_XIAO_M0) )
#define BOARD_TYPE "SAMD Zero"
#elif defined(ARDUINO_SAMD_MKR1000)
#define BOARD_TYPE "SAMD MKR1000"
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
#define BOARD_TYPE "SAMD MKRWIFI1010"
#elif defined(ARDUINO_SAMD_NANO_33_IOT)
#define BOARD_TYPE "SAMD NANO_33_IOT"
#elif defined(ARDUINO_SAMD_MKRFox1200)
#define BOARD_TYPE "SAMD MKRFox1200"
#elif ( defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) )
#define BOARD_TYPE "SAMD MKRWAN13X0"
#elif defined(ARDUINO_SAMD_MKRGSM1400)
#define BOARD_TYPE "SAMD MKRGSM1400"
#elif defined(ARDUINO_SAMD_MKRNB1500)
#define BOARD_TYPE "SAMD MKRNB1500"
#elif defined(ARDUINO_SAMD_MKRVIDOR4000)
#define BOARD_TYPE "SAMD MKRVIDOR4000"
#elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
#define BOARD_TYPE "SAMD ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS"
#elif defined(ADAFRUIT_FEATHER_M0_EXPRESS)
#define BOARD_TYPE "SAMD21 ADAFRUIT_FEATHER_M0_EXPRESS"
#elif defined(ADAFRUIT_METRO_M0_EXPRESS)
#define BOARD_TYPE "SAMD21 ADAFRUIT_METRO_M0_EXPRESS"
#elif defined(ADAFRUIT_CIRCUITPLAYGROUND_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_CIRCUITPLAYGROUND_M0"
#elif defined(ADAFRUIT_GEMMA_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_GEMMA_M0"
#elif defined(ADAFRUIT_TRINKET_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_TRINKET_M0"
#elif defined(ADAFRUIT_ITSYBITSY_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_ITSYBITSY_M0"
#elif defined(ARDUINO_SAMD_HALLOWING_M0)
#define BOARD_TYPE "SAMD21 ARDUINO_SAMD_HALLOWING_M0"
#elif defined(ADAFRUIT_METRO_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_EXPRESS"
#elif defined(ADAFRUIT_GRAND_CENTRAL_M4)
#define BOARD_TYPE "SAMD51 ADAFRUIT_GRAND_CENTRAL_M4"
#elif defined(ADAFRUIT_FEATHER_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_FEATHER_M4_EXPRESS"
#elif defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS"
#elif defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_TRELLIS_M4_EXPRESS"
#elif defined(ADAFRUIT_PYPORTAL)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL"
#elif defined(ADAFRUIT_PYPORTAL_M4_TITANO)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL_M4_TITANO"
#elif defined(ADAFRUIT_PYBADGE_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_M4_EXPRESS"
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
#define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE"
#elif defined(ADAFRUIT_PYGAMER_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_M4_EXPRESS"
#elif defined(ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS"
#elif defined(ADAFRUIT_PYBADGE_AIRLIFT_M4)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_AIRLIFT_M4"
#elif defined(ADAFRUIT_MONSTER_M4SK_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_MONSTER_M4SK_EXPRESS"
#elif defined(ADAFRUIT_HALLOWING_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_HALLOWING_M4_EXPRESS"
#elif defined(SEEED_WIO_TERMINAL)
#define BOARD_TYPE "SAMD SEEED_WIO_TERMINAL"
#elif defined(SEEED_FEMTO_M0)
#define BOARD_TYPE "SAMD SEEED_FEMTO_M0"
#elif defined(SEEED_XIAO_M0)
#define BOARD_TYPE "SAMD SEEED_XIAO_M0"
#ifdef USE_THIS_SS_PIN
#undef USE_THIS_SS_PIN
#endif
#define USE_THIS_SS_PIN A1
#warning define SEEED_XIAO_M0 USE_THIS_SS_PIN == A1
#elif defined(Wio_Lite_MG126)
#define BOARD_TYPE "SAMD SEEED Wio_Lite_MG126"
#elif defined(WIO_GPS_BOARD)
#define BOARD_TYPE "SAMD SEEED WIO_GPS_BOARD"
#elif defined(SEEEDUINO_ZERO)
#define BOARD_TYPE "SAMD SEEEDUINO_ZERO"
#elif defined(SEEEDUINO_LORAWAN)
#define BOARD_TYPE "SAMD SEEEDUINO_LORAWAN"
#elif defined(SEEED_GROVE_UI_WIRELESS)
#define BOARD_TYPE "SAMD SEEED_GROVE_UI_WIRELESS"
#elif defined(__SAMD21E18A__)
#define BOARD_TYPE "SAMD21E18A"
#elif defined(__SAMD21G18A__)
#define BOARD_TYPE "SAMD21G18A"
#elif defined(__SAMD51G19A__)
#define BOARD_TYPE "SAMD51G19A"
#elif defined(__SAMD51J19A__)
#define BOARD_TYPE "SAMD51J19A"
#elif defined(__SAMD51P19A__)
#define BOARD_TYPE "__SAMD51P19A__"
#elif defined(__SAMD51J20A__)
#define BOARD_TYPE "SAMD51J20A"
#elif defined(__SAM3X8E__)
#define BOARD_TYPE "SAM3X8E"
#elif defined(__CPU_ARC__)
#define BOARD_TYPE "CPU_ARC"
#elif defined(__SAMD51__)
#define BOARD_TYPE "SAMD51"
#else
#define BOARD_TYPE "SAMD Unknown"
#endif
#elif defined(WIFI_USE_STM32) || defined(ETHERNET_USE_STM32)
// For STM32
#warning EspSerial using SERIAL_PORT_HARDWARE, can be Serial or Serial1. See your board variant.h
#define EspSerial SERIAL_PORT_HARDWARE //Serial1
#if defined(STM32F0)
#warning STM32F0 board selected
#define BOARD_TYPE "STM32F0"
#elif defined(STM32F1)
#warning STM32F1 board selected
#define BOARD_TYPE "STM32F1"
#elif defined(STM32F2)
#warning STM32F2 board selected
#define BOARD_TYPE "STM32F2"
#elif defined(STM32F3)
#warning STM32F3 board selected
#define BOARD_TYPE "STM32F3"
#elif defined(STM32F4)
#warning STM32F4 board selected
#define BOARD_TYPE "STM32F4"
#elif defined(STM32F7)
#warning STM32F7 board selected
#define BOARD_TYPE "STM32F7"
#elif defined(STM32L0)
#warning STM32L0 board selected
#define BOARD_TYPE "STM32L0"
#elif defined(STM32L1)
#warning STM32L1 board selected
#define BOARD_TYPE "STM32L1"
#elif defined(STM32L4)
#warning STM32L4 board selected
#define BOARD_TYPE "STM32L4"
#elif defined(STM32H7)
#warning STM32H7 board selected
#define BOARD_TYPE "STM32H7"
#elif defined(STM32G0)
#warning STM32G0 board selected
#define BOARD_TYPE "STM32G0"
#elif defined(STM32G4)
#warning STM32G4 board selected
#define BOARD_TYPE "STM32G4"
#elif defined(STM32WB)
#warning STM32WB board selected
#define BOARD_TYPE "STM32WB"
#elif defined(STM32MP1)
#warning STM32MP1 board selected
#define BOARD_TYPE "STM32MP1"
#else
#warning STM32 unknown board selected
#define BOARD_TYPE "STM32 Unknown"
#endif
#elif ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
// For SAM DUE
#define EspSerial Serial1
#warning SAM DUE board selected
#define BOARD_TYPE "SAM DUE"
#elif (ESP8266)
#warning ESP8266 board selected
#elif (ESP32)
#warning ESP32 board selected
#elif defined(WIFI_USE_MEGA_AVR) || defined(ETHERNET_USE_MEGA_AVR)
// For megaAVR such as UNO WiFi Rev2
#define EspSerial Serial1
#if defined(ARDUINO_AVR_UNO_WIFI_REV2)
#define BOARD_TYPE "ARDUINO_AVR_UNO_WIFI_REV2"
#elif defined(ARDUINO_AVR_NANO_EVERY)
#define BOARD_TYPE "ARDUINO_AVR_NANO_EVERY"
#else
#define BOARD_TYPE "Unknown MegaAVR ATmega4809"
#endif
#warning megaAVR ATmega4809 board selected
#ifndef BOARD_TYPE
#define BOARD_TYPE "MegaAVR ATmega4809"
#endif
#elif defined(WIFI_USE_AVR) || defined(ETHERNET_USE_AVR)
// For Mega
#define EspSerial Serial3
#if defined(ARDUINO_AVR_MEGA2560)
#define BOARD_TYPE "AVR_MEGA2560"
#elif defined(ARDUINO_AVR_MEGA)
#define BOARD_TYPE "ARDUINO_AVR_MEGA"
#elif defined(ARDUINO_AVR_ADK)
#define BOARD_TYPE "ARDUINO_AVR_ADK"
#endif
#warning AVR Mega board selected
#ifndef BOARD_TYPE
#define BOARD_TYPE "AVR Mega"
#endif
#else
// For UNO, Nano
#error UNO, Nano, etc. not supported. Not enough memory
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define BOARD_TYPE "Unsupported AVR"
#endif // #ifdef CORE_TEENSY
/////////////////////////////////
#if (ESP8266 || ESP32)
#ifdef DDNS_USING_WIFI
#undef DDNS_USING_WIFI
#endif
#ifdef DDNS_USING_ETHERNET
#undef DDNS_USING_ETHERNET
#endif
#warning Using Built-in ESP WiFi for ESP8266/ESP32
#define SHIELD_TYPE "Built-in ESP WiFi"
#define DDNS_USING_WIFI true
#define DDNS_USING_ETHERNET false
#elif ( (DDNS_USING_WIFI) && !(ESP8266 || ESP32) )
// Select one to be true: USE_WIFI_NINA, DDNS_USING_WIFI_AT or USE_WIFI_CUSTOM
//#define USE_WIFI_NINA true
#define USE_WIFI_NINA false
#define DDNS_USING_WIFI_AT true
//#define DDNS_USING_WIFI_AT false
// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here
//#define USE_WIFI_CUSTOM true
#define USE_WIFI_CUSTOM false
#if !(USE_WIFI_NINA || DDNS_USING_WIFI_AT || USE_WIFI_CUSTOM)
#error Select either USE_WIFI_NINA || DDNS_USING_WIFI_AT || USE_WIFI_CUSTOM to be true
#endif
#if defined(ARDUINO_SAMD_MKR1000)
#if defined(USE_WIFI_NINA)
#undef USE_WIFI_NINA
#endif
#define USE_WIFI_NINA false
#define USE_WIFI101 true
#define SHIELD_TYPE "WiFi101"
#endif
#if (!USE_WIFI101)
#if USE_WIFI_NINA
#warning Using WiFiNINA and WiFiNINA_Generic Library
#define SHIELD_TYPE "WiFiNINA using WiFiNINA_Generic Library"
#elif DDNS_USING_WIFI_AT
#warning Using ESP8266-AT/ESP32-AT and ESP8266_AT_WebServer Library
#define SHIELD_TYPE "ESP8266-AT/ESP32-AT using ESP8266_AT_WebServer Library"
#elif USE_WIFI_CUSTOM
#warning Using Custom WiFi
#define SHIELD_TYPE "Custom WiFi"
//#include "WiFi_XYZ.h"
#include "WiFiEspAT.h"
#endif
#endif
#elif DDNS_USING_ETHERNET
// This must be true if using LAN8742A for STM32F, such as Nucleo-144 F767ZI
#define USE_BUILTIN_ETHERNET false
//////////
#define USE_UIP_ETHERNET false
#define USE_CUSTOM_ETHERNET false
// Only one if the following to be true
#define USE_ETHERNET_GENERIC true
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_UIP_ETHERNET false
#define USE_CUSTOM_ETHERNET false
////////////////////////////
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ESP8266 || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET )
#ifdef USE_CUSTOM_ETHERNET
#undef USE_CUSTOM_ETHERNET
#define USE_CUSTOM_ETHERNET false
#endif
#endif
// Currently, only Ethernet lib available for STM32 using W5x00
#if !(USE_BUILTIN_ETHERNET || ETHERNET_USE_STM32)
#if USE_NATIVE_ETHERNET
#include "NativeEthernet.h"
#warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
#define SHIELD_TYPE "Custom Ethernet using Teensy 4.1 NativeEthernet Library"
#elif USE_ETHERNET_GENERIC
#include "Ethernet_Generic.h"
#warning Using Ethernet_Generic lib
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library"
#define ETHERNET_LARGE_BUFFERS
#elif USE_ETHERNET_ESP8266
#include "Ethernet_ESP8266.h"
#warning Use Ethernet_ESP8266 lib
#define SHIELD_TYPE "W5x00 using Ethernet_ESP8266 Library"
#elif USE_ETHERNET_ENC
#include "EthernetENC.h"
#warning Use EthernetENC lib
#define SHIELD_TYPE "ENC28J60 using EthernetENC Library"
#elif USE_CUSTOM_ETHERNET
#include "Ethernet_XYZ.h"
#warning Use Custom Ethernet library from EthernetWrapper. You must include a library here or error.
#define SHIELD_TYPE "using Custom Ethernet Library"
#elif USE_UIP_ETHERNET
#include "UIPEthernet.h"
#warning Use UIPEthernet library
#define SHIELD_TYPE "ENC28J60 using UIPEthernet Library"
#else
#ifdef USE_ETHERNET_GENERIC
#undef USE_ETHERNET_GENERIC
#endif
#define USE_ETHERNET_GENERIC true
#include "Ethernet_Generic.h"
#warning Using default Ethernet_Generic lib
#define SHIELD_TYPE "W5x00 using default Ethernet_Generic Library"
#endif
#elif USE_BUILTIN_ETHERNET
#warning Use built-in LAN8742A Library
#define SHIELD_TYPE "LAN8742A using STM32Ethernet Library"
#endif
#endif // (ESP6288 || ESP32)
/////////////////////////////////
#if ( (DDNS_USING_WIFI) && !(ESP8266 || ESP32) )
#if DDNS_USING_WIFI_AT
#include <ESP8266_AT_WebServer.h>
#else
#include <WiFiWebServer.h>
#endif
#elif DDNS_USING_ETHERNET
#if (ETHERNET_USE_STM32)
#include <EthernetWebServer_STM32.h>
#else
#include <EthernetWebServer.h>
#endif
#endif
/////////////////////////////////
#ifndef BOARD_NAME
#ifdef ARDUINO_BOARD
#define BOARD_NAME ARDUINO_BOARD
#else
#define BOARD_NAME BOARD_TYPE
#endif
#endif
#ifndef SHIELD_TYPE
#define SHIELD_TYPE "Unknown shield"
#endif
/////////////////////////////////
#include <DDNS_Generic.h>
#if (DDNS_USING_WIFI)
#if DDNS_USING_WIFI_AT
ESP8266_AT_WebServer server(80);
#else
WiFiServer server(80);
#endif
#include "wifi_credentials.h"
const char* ssid = SECRET_SSID;
const char* password = SECRET_PASS;
#elif (DDNS_USING_ETHERNET)
EthernetServer server(80);
// Enter a MAC address and IP address for your controller below.
#define NUMBER_OF_MAC 20
byte mac[][NUMBER_OF_MAC] =
{
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 },
};
// Select the IP address according to your local network
IPAddress ip(192, 168, 2, 222);
#endif
/////////////////////////////////
#endif //defines_h