AceTime  3.0.0
Date and time classes for Arduino that support timezones from the TZ Database.
compat.h
Go to the documentation of this file.
1 /*
2  * MIT License
3  * Copyright (c) 2018 Brian T. Park
4  */
5 
6 #ifndef ACE_TIME_ZONEINFO_COMPAT_H
7 #define ACE_TIME_ZONEINFO_COMPAT_H
8 
18 #include <stdint.h>
19 #include <string.h>
20 #include <WString.h> // FPSTR(), __FlashStringHelper
21 
23 #define ACE_TIME_USE_PROGMEM 1
24 #if ACE_TIME_USE_PROGMEM
25  #define ACE_TIME_PROGMEM PROGMEM
26 #else
27  #define ACE_TIME_PROGMEM
28 #endif
29 
30 // Some 3rd party Arduino cores does not define FPSTR(). And unfortunately, when
31 // they do, sometimes it's wrong, so we sometimes have to clobber it below.
32 #if ! defined(FPSTR)
33  #define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p))
34 #endif
35 
36 // Include the correct pgmspace.h depending on architecture.
37 #if defined(ARDUINO_ARCH_AVR)
38  #include <avr/pgmspace.h>
39 
40 // Seeeduino SAMD21 Core does not define an identifier for the following, so
41 // they are not supported:
42 // * Wio lite MG126
43 // * Wio GPS Board
44 // * Wio LTE CAT.1
45 //
46 #elif defined(SEEED_XIAO_M0) \
47  || defined(SEEEDUINO_ZERO) \
48  || defined(SEEED_FEMTO_M0) \
49  || defined(SEEEDUINO_LORAWAN) \
50  || defined(SEEED_WIO_TERMINAL) \
51  || defined(SEEED_GROVE_UI_WIRELESS)
52 
53  #include <avr/pgmspace.h>
54 
55  // Seeeduino (as of 1.8.3) provides an incorrect definition of FPSTR()
56  // so we have to clobber it.
57  #undef FPSTR
58  #define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p))
59 
60 #elif defined(ARDUINO_ARCH_SAMD)
61  #include <avr/pgmspace.h>
62 
63  // Set this to 1 to clobber SERIAL_PORT_MONITOR to SerialUSB on
64  // an original Arduino Zero when using the Native port. See USER_GUIDE.md for
65  // more info.
66  #define ACE_TIME_CLOBBER_SERIAL_PORT_MONITOR 0
67  #if ACE_TIME_CLOBBER_SERIAL_PORT_MONITOR && defined(ARDUINO_SAMD_ZERO)
68  #undef SERIAL_PORT_MONITOR
69  #define SERIAL_PORT_MONITOR SerialUSB
70  #endif
71 
72 #elif defined(ARDUINO_ARCH_STM32)
73  #include <avr/pgmspace.h>
74 
75 #elif defined(ARDUINO_ARCH_ESP8266)
76  #include <pgmspace.h>
77 
78 #elif defined(ARDUINO_ARCH_ESP32)
79  #include <pgmspace.h>
80 
81  #if ! defined(SERIAL_PORT_MONITOR)
82  #define SERIAL_PORT_MONITOR Serial
83  #endif
84 
85 #elif defined(TEENSYDUINO)
86  #include <avr/pgmspace.h>
87 
88 #elif defined(EPOXY_DUINO)
89  #include <pgmspace.h>
90 
91 #else
92  #warning Untested platform. AceTime may still work...
93 
94  #include <avr/pgmspace.h>
95 
96 #endif
97 
98 #endif // ACE_TIME_ZONEINFO_COMPAT_H