From b56f705f05e179548714267f3f8a163a3acad603 Mon Sep 17 00:00:00 2001 From: 135 Date: Sun, 21 Jul 2024 20:30:17 +0300 Subject: [PATCH] =?UTF-8?q?WIP=20=D0=B0=D0=B4=D0=B0=D0=BF=D1=82=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F.=20=D0=B2=20Serial=20=D0=B2=D1=8B=D0=B2?= =?UTF-8?q?=D0=BE=D0=B4=D1=8F=D1=82=D1=81=D1=8F=20PPS/SQW=20=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=20LCD=20=D0=BF=D0=B5=D1=87=D0=B0=D1=82=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=D1=81=D1=8F=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Font_Chrono1.h | 168 ++++++++++++++++++++ GPS_RTC_Clock-main.ino => GPS_RTC_Clock.ino | 45 +++++- GPS_com.cpp | 14 +- RTC_com.cpp | 8 +- Timezone_Generic.h | 46 ++++++ 5 files changed, 271 insertions(+), 10 deletions(-) create mode 100644 Font_Chrono1.h rename GPS_RTC_Clock-main.ino => GPS_RTC_Clock.ino (82%) create mode 100644 Timezone_Generic.h diff --git a/Font_Chrono1.h b/Font_Chrono1.h new file mode 100644 index 0000000..18f5b6d --- /dev/null +++ b/Font_Chrono1.h @@ -0,0 +1,168 @@ +/* + * + * Font_Chrono1 + * + * created with FontCreator + * written by F. Maximilian Thiele + * + * http://www.apetech.de/fontCreator + * me@apetech.de + * + * File Name : Font_Chrono1.h + * Date : 10.01.2012 + * Font size in bytes : 12422 + * Font width : 10 + * Font height : 16 + * Font first char : 32 + * Font last char : 128 + * Font used chars : 96 + * + * The font data are defined as + * + * struct _FONT_ { + * uint16_t font_Size_in_Bytes_over_all_included_Size_it_self; + * uint8_t font_Width_in_Pixel_for_fixed_drawing; + * uint8_t font_Height_in_Pixel_for_all_characters; + * unit8_t font_First_Char; + * uint8_t font_Char_Count; + * + * uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1]; + * // for each character the separate width in pixels, + * // characters < 128 have an implicit virtual right empty row + * + * uint8_t font_data[]; + * // bit field of all characters + */ + +//#include +#ifdef __AVR__ +#include +#else +#define PROGMEM +#endif + +#ifndef Font_CHRONO1_H +#define Font_CHRONO1_H + +#define Font_CHRONO1_WIDTH 10 +#define Font_CHRONO1_HEIGHT 16 + +static const uint8_t Font_Chrono1[] PROGMEM = { + 0x30, 0x86, // size + 0x0A, // width + 0x10, // height + 0x20, // first char + 0x60, // char count + + // char widths + 0x00, 0x03, 0x07, 0x0B, 0x09, 0x0E, 0x0B, 0x03, 0x05, 0x05, + 0x06, 0x09, 0x03, 0x05, 0x03, 0x04, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x03, 0x09, 0x08, + 0x09, 0x08, 0x0C, 0x0C, 0x09, 0x09, 0x09, 0x09, 0x08, 0x0A, + 0x0A, 0x03, 0x09, 0x0C, 0x08, 0x0C, 0x0A, 0x0A, 0x09, 0x0A, + 0x0A, 0x09, 0x0B, 0x0A, 0x0C, 0x10, 0x0C, 0x0B, 0x09, 0x05, + 0x04, 0x05, 0x08, 0x08, 0x03, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x06, 0x09, 0x09, 0x03, 0x04, 0x0A, 0x03, 0x0D, 0x09, 0x09, + 0x09, 0x09, 0x06, 0x08, 0x06, 0x09, 0x09, 0x0F, 0x0B, 0x09, + 0x07, 0x06, 0x02, 0x06, 0x09, 0x08, + + // font data + 0xFE, 0xFE, 0xFE, 0x1D, 0x1D, 0x1D, // 33 + 0x1E, 0x1E, 0x1E, 0x00, 0x1E, 0x1E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 34 + 0x30, 0x30, 0xF0, 0xFE, 0x3E, 0x30, 0x30, 0xF0, 0xFE, 0x3E, 0x30, 0x06, 0x1E, 0x1F, 0x07, 0x06, 0x06, 0x1E, 0x1F, 0x07, 0x06, 0x06, // 35 + 0x38, 0x7C, 0xFE, 0xE6, 0xFF, 0xC6, 0xCE, 0x8C, 0x0C, 0x04, 0x0C, 0x1C, 0x18, 0x3F, 0x19, 0x1F, 0x0F, 0x07, // 36 + 0x3C, 0x7E, 0x42, 0x42, 0x7E, 0x3C, 0x80, 0x60, 0x10, 0x8C, 0x82, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0C, 0x02, 0x01, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x1F, 0x0F, // 37 + 0x00, 0x80, 0x9C, 0xFE, 0xFE, 0xE6, 0xBE, 0x3E, 0x9C, 0x80, 0x80, 0x07, 0x0F, 0x1F, 0x19, 0x18, 0x19, 0x1F, 0x0F, 0x0F, 0x1F, 0x1D, // 38 + 0x1E, 0x1E, 0x1E, 0x00, 0x00, 0x00, // 39 + 0xE0, 0xF8, 0xFC, 0x1E, 0x02, 0x0F, 0x3F, 0x7F, 0xF0, 0x80, // 40 + 0x02, 0x1E, 0xFC, 0xF8, 0xE0, 0x80, 0xF0, 0x7F, 0x3F, 0x0F, // 41 + 0x08, 0x68, 0x3E, 0x3E, 0x68, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 42 + 0xC0, 0xC0, 0xC0, 0xF8, 0xF8, 0xF8, 0xC0, 0xC0, 0xC0, 0x01, 0x01, 0x01, 0x0F, 0x0F, 0x0F, 0x01, 0x01, 0x01, // 43 + 0x00, 0x00, 0x00, 0xDC, 0x7C, 0x3C, // 44 + 0x80, 0x80, 0x80, 0x80, 0x80, 0x03, 0x03, 0x03, 0x03, 0x03, // 45 + 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x1C, // 46 + 0x00, 0x80, 0x78, 0x06, 0x18, 0x07, 0x00, 0x00, // 47 + 0xFC, 0xFE, 0x07, 0x03, 0x03, 0x07, 0xFE, 0xFC, 0x3F, 0x7F, 0xE0, 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59 + 0xE0, 0xE0, 0xE0, 0xF0, 0x70, 0x70, 0x70, 0x38, 0x38, 0x03, 0x03, 0x03, 0x07, 0x07, 0x07, 0x07, 0x0E, 0x0E, // 60 + 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, // 61 + 0x38, 0x38, 0x70, 0x70, 0x70, 0xF0, 0xE0, 0xE0, 0xE0, 0x0E, 0x0E, 0x07, 0x07, 0x07, 0x07, 0x03, 0x03, 0x03, // 62 + 0x18, 0x1C, 0x9E, 0xC6, 0xE6, 0xFE, 0x7C, 0x38, 0x00, 0x00, 0x1D, 0x1D, 0x1D, 0x00, 0x00, 0x00, // 63 + 0xE0, 0x18, 0xC4, 0xF4, 0x3A, 0x0A, 0x0A, 0xF2, 0xFA, 0x7C, 0x08, 0xF0, 0x07, 0x18, 0x27, 0x2F, 0x48, 0x48, 0x4C, 0x4F, 0x4F, 0x28, 0x36, 0x11, // 64 + 0x00, 0x80, 0xE0, 0xF8, 0xFE, 0x1E, 0xFE, 0xF8, 0xE0, 0x80, 0x00, 0x00, 0x1C, 0x1F, 0x0F, 0x07, 0x06, 0x06, 0x06, 0x07, 0x0F, 0x1F, 0x1C, 0x10, // 65 + 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xFE, 0xBC, 0x98, 0x00, 0x1F, 0x1F, 0x1F, 0x18, 0x18, 0x18, 0x1F, 0x0F, 0x07, // 66 + 0xF0, 0xFC, 0xFC, 0x0E, 0x06, 0x0E, 0x1E, 0x1C, 0x08, 0x03, 0x0F, 0x1F, 0x1C, 0x18, 0x1C, 0x1F, 0x0E, 0x06, // 67 + 0xFE, 0xFE, 0xFE, 0x06, 0x06, 0x0E, 0xFE, 0xFC, 0xF0, 0x1F, 0x1F, 0x1F, 0x18, 0x18, 0x1C, 0x1F, 0x0F, 0x03, // 68 + 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC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 0x80, 0x00, 0xF8, 0xFE, 0xFE, 0x06, 0x00, 0x0F, 0x1F, 0x1F, 0x1F, 0x07, 0x01, 0x00, 0x01, 0x07, 0x1F, 0x1F, 0x1F, 0x0F, 0x00, 0x00, // 87 + 0x06, 0x1E, 0x3C, 0xF8, 0xF0, 0xE0, 0xF0, 0xF8, 0x3C, 0x1E, 0x06, 0x02, 0x18, 0x1E, 0x0F, 0x07, 0x03, 0x01, 0x03, 0x07, 0x0F, 0x1E, 0x18, 0x10, // 88 + 0x02, 0x0E, 0x1E, 0x7E, 0xF8, 0xE0, 0xF8, 0x7E, 0x1E, 0x0E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, // 89 + 0x00, 0x06, 0x06, 0xC6, 0xE6, 0xF6, 0x3E, 0x1E, 0x0E, 0x1C, 0x1E, 0x1F, 0x1B, 0x19, 0x18, 0x18, 0x18, 0x18, // 90 + 0xFE, 0xFE, 0xFE, 0x06, 0x06, 0xFF, 0xFF, 0xFF, 0xC0, 0xC0, // 91 + 0x06, 0x78, 0x80, 0x00, 0x00, 0x00, 0x07, 0x18, // 92 + 0x06, 0x06, 0xFE, 0xFE, 0xFE, 0xC0, 0xC0, 0xFF, 0xFF, 0xFF, // 93 + 0x40, 0x70, 0x7C, 0x1E, 0x1E, 0x7C, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 94 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // 95 + 0x02, 0x06, 0x04, 0x00, 0x00, 0x00, // 96 + 0x40, 0x60, 0x70, 0x30, 0xB0, 0xB0, 0xF0, 0xF0, 0xE0, 0x0E, 0x1F, 0x1F, 0x1B, 0x19, 0x09, 0x1F, 0x1F, 0x1F, // 97 + 0xFE, 0xFE, 0xFE, 0x60, 0x30, 0x30, 0xF0, 0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00, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F, 0x1F, // 109 + 0xF0, 0xF0, 0xF0, 0x20, 0x30, 0x30, 0xF0, 0xF0, 0xE0, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, // 110 + 0xC0, 0xE0, 0xF0, 0x70, 0x30, 0x70, 0xF0, 0xE0, 0xC0, 0x07, 0x0F, 0x1F, 0x1C, 0x18, 0x1C, 0x1F, 0x0F, 0x07, // 111 + 0xF0, 0xF0, 0xF0, 0x60, 0x30, 0x70, 0xF0, 0xE0, 0xC0, 0xFF, 0xFF, 0xFF, 0x0C, 0x18, 0x18, 0x1F, 0x0F, 0x07, // 112 + 0xC0, 0xE0, 0xF0, 0x30, 0x30, 0x60, 0xF0, 0xF0, 0xF0, 0x07, 0x0F, 0x1F, 0x18, 0x18, 0x0C, 0xFF, 0xFF, 0xFF, // 113 + 0xF0, 0xF0, 0xF0, 0x20, 0x30, 0x10, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, // 114 + 0xE0, 0xF0, 0xF0, 0x90, 0x90, 0xB0, 0x30, 0x20, 0x08, 0x19, 0x1B, 0x13, 0x13, 0x1F, 0x1F, 0x0E, // 115 + 0x30, 0xFC, 0xFC, 0xFE, 0x30, 0x30, 0x00, 0x0F, 0x1F, 0x1F, 0x18, 0x18, // 116 + 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0x0F, 0x1F, 0x1F, 0x18, 0x18, 0x08, 0x1F, 0x1F, 0x1F, // 117 + 0x10, 0xF0, 0xF0, 0xC0, 0x00, 0xE0, 0xF0, 0xF0, 0x10, 0x00, 0x00, 0x07, 0x1F, 0x1C, 0x1F, 0x07, 0x00, 0x00, // 118 + 0x10, 0xF0, 0xF0, 0xE0, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0x10, 0x00, 0x00, 0x07, 0x1F, 0x1E, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x1E, 0x1F, 0x07, 0x00, 0x00, // 119 + 0x10, 0x30, 0x70, 0xE0, 0xC0, 0x80, 0xC0, 0xE0, 0x70, 0x30, 0x10, 0x10, 0x18, 0x1E, 0x0F, 0x07, 0x03, 0x07, 0x0F, 0x1E, 0x18, 0x10, // 120 + 0x10, 0xF0, 0xF0, 0xC0, 0x00, 0xC0, 0xF0, 0xF0, 0x30, 0xC0, 0xC0, 0xC7, 0xFF, 0xFC, 0x3F, 0x0F, 0x01, 0x00, // 121 + 0x30, 0x30, 0x30, 0xF0, 0xF0, 0xF0, 0x30, 0x1C, 0x1E, 0x1F, 0x1B, 0x19, 0x18, 0x18, // 122 + 0x00, 0x00, 0xFC, 0xFE, 0xFE, 0x06, 0x03, 0x03, 0x7F, 0xFF, 0xFC, 0xC0, // 123 + 0xFE, 0xFE, 0xFF, 0xFF, // 124 + 0x06, 0xFE, 0xFE, 0xFC, 0x00, 0x00, 0xC0, 0xFC, 0xFF, 0x7F, 0x03, 0x03, // 125 + 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, // 126 + 0xF8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F // 127 + +}; + +#endif diff --git a/GPS_RTC_Clock-main.ino b/GPS_RTC_Clock.ino similarity index 82% rename from GPS_RTC_Clock-main.ino rename to GPS_RTC_Clock.ino index 803a998..a51b2ac 100644 --- a/GPS_RTC_Clock-main.ino +++ b/GPS_RTC_Clock.ino @@ -10,22 +10,57 @@ #include // needed for Nano Every #include "GPS_RTC_Clock.h" #include "LED_96x8_matrix.h" +#include +#include +#include "Font_Chrono1.h" + +#define pin_RTC_SQW 3; + +SoftDMD dmd(2, 1); +LiquidCrystal_I2C lcd(0x27, 16, 2); + +unsigned long tmr_Blink; + char TempBuf[5] = "99.9"; // demo value char HumiBuf[3] = "99"; // demo value - void setup() { // the setup function runs once when you press reset or power the board GPS_RTC_Clock_setup(); // first in setup - Matrix_setup(); // LED display - Serial.begin(9600); // = 9600, must be same as GPS for debug + //Matrix_setup(); // LED display + dmd.setBrightness(5); + dmd.selectFont(Font_Chrono1); + dmd.begin(); + dmd.clearScreen(); + // LCD + lcd.init(); // Инициализация дисплея + lcd.clear(); + lcd.backlight(); + + Serial.begin(19200); // = 9600, must be same as GPS for debug Serial.println(); // flush serial Serial.println("-Arduino Reboot-"); // debug } void loop() { // the loop function runs over and over again forever +// if (millis() - tmr_Blink > 500) { +// Serial.println("DEBUG[BLINK] " + int(digitalRead(13))); +// tmr_Blink = millis(); +// digitalWrite(13, !digitalRead(13)); +// } + GPS_RTC_Clock_loop(); // first in loop - PrintSec(); - PrintHour(); + //PrintSec(); + //PrintHour(); + if (NewSec) { + RTCtoLCD(); + } +} + +void RTCtoLCD() { + char sz[32]; + sprintf(sz, "%02d:%02d:%02d ", hour(Loc_t), minute(Loc_t), second(Loc_t)); + lcd.setCursor(0,0); + lcd.print(sz); } void PrintSec() { // print time if new second diff --git a/GPS_com.cpp b/GPS_com.cpp index 09c3cae..9a23511 100644 --- a/GPS_com.cpp +++ b/GPS_com.cpp @@ -11,8 +11,12 @@ #include "GPS_com.h" #include "RTC_com.h" // to set the RTC +#define cfg_pin_GPS_PPS 2; +#define cfg_pin_GPS_Rx 4; +#define cfg_pin_GPS_Tx 5; + // add the static modifier to limit visibility of these variables to just this file -static byte GPS_PPS_PIN = 2; // Pin 2 = NANO INT0, GPS PPS interrupt signal on this Pin +static byte GPS_PPS_PIN = cfg_pin_GPS_PPS; // Pin 2 = NANO INT0, GPS PPS interrupt signal on this Pin static bool gps_on; // flag for GPS ON/OFF static int pulse_count = 0; static time_t gps_seconds_t = 0; // GPS time @@ -21,14 +25,17 @@ volatile bool GPS_sec = false; // flag for GPS-PPS // set interrupt flag void gps_interrupt() { + Serial.println("DEBUG[INT] GPS interrupt"); GPS_sec = true; } NMEAGPS gps; // This parses the GPS characters gps_fix fix; // This holds on to the latest values //#include // use only for soft-serial -#define gpsPort Serial -#define GPS_PORT_NAME "Serial" +#include +NeoSWSerial gpsPort(4, 5); +//#define gpsPort Serial +#define GPS_PORT_NAME "NeoSWSerial(4, 5)" #define DEBUG_PORT Serial /***** Notice ******************************************** @@ -89,6 +96,7 @@ void GPS_PPS() { // do something on the flip of the GPS second } void GPS_read_seconds() { + //Serial.println("DEBUG[GPS_read_second()] Start"); while (gps.available(gpsPort)) { fix = gps.read(); if (fix.valid.time && fix.valid.date) { diff --git a/RTC_com.cpp b/RTC_com.cpp index e75ed2d..3bc52cd 100644 --- a/RTC_com.cpp +++ b/RTC_com.cpp @@ -10,20 +10,23 @@ #include // https://github.com/PaulStoffregen/Time [valid until year 2099, no 2038 bug] #include "RTC_com.h" +#define cfg_pin_RTC_SQW 3; + // add the static modifier to limit visibility of these variables to just this file static int ledPin_PPS = A6; // Pin for RTC PseudoPPS LED [analog PIN used as digital PIN] static int ledPin_Sync = A7; // Pin for valid RTC Sync -static byte RTC_1HZ_PIN = 3; // Pin 3 = NANO INT1, RTC provides a 1Hz interrupt signal on this Pin +static byte RTC_1HZ_PIN = cfg_pin_RTC_SQW; // Pin 3 = NANO INT1, RTC provides a 1Hz interrupt signal on this Pin static time_t last_sync_t = 0; // last sync static byte sync_err_hours = 4; // set to 4 for DS3231M, may be set to 8 for DS3231SN. Warning if no GPS sync after n hours, possible 0.1 sec error. bool SyncErr = true; #include -DS3232RTC myRTC; +DS3232RTC myRTC(0x68); // cfg_ volatile bool RTC_sec = false; // flag for PseudoPPS static unsigned long RTCMillis; // blinking timer void rtc_interrupt() { + Serial.println("DEBUG[INT] RTC interrupt"); RTCMillis = millis(); RTC_sec = true; } @@ -44,6 +47,7 @@ void RTC_setup() { } void RTC_loop() { + //Serial.println("DEBUG[RTC_loop()] Start"); if (RTC_sec) { // do after RTC PseudoPPS interrupt, without interrupt NO time/date to display RTC_sec = false; // clear flag digitalWrite(ledPin_PPS, LOW); // LED off diff --git a/Timezone_Generic.h b/Timezone_Generic.h new file mode 100644 index 0000000..dba8d14 --- /dev/null +++ b/Timezone_Generic.h @@ -0,0 +1,46 @@ +/********************************************************************************************************************************* + Timezone_Generic.h + + For AVR, ESP8266/ESP32, SAMD21/SAMD51, nRF52, STM32, WT32_ETH01 boards + + Based on and modified from Arduino Timezone Library (https://github.com/JChristensen/Timezone) + to support other boards such as ESP8266/ESP32, SAMD21, SAMD51, Adafruit's nRF52 boards, etc. + + Copyright (C) 2018 by Jack Christensen and licensed under GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html + + Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic + Licensed under MIT license + + Version: 1.10.1 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards + using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage. + 1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC. + 1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt) + 1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc. + Fix compiler warnings. + 1.4.0 K Hoang 04/06/2021 Add support to RP2040-based boards using RP2040 Arduino-mbed or arduino-pico core + 1.5.0 K Hoang 13/06/2021 Add support to ESP32-S2 and ESP32-C3. Fix bug + 1.6.0 K Hoang 16/07/2021 Add support to WT32_ETH01 + 1.7.0 K Hoang 10/08/2021 Add support to Ameba Realtek RTL8720DN, RTL8722DM and RTM8722CSM + 1.7.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` + 1.7.2 K Hoang 02/11/2021 Fix crashing issue for new cleared flash + 1.7.3 K Hoang 01/12/2021 Auto detect ESP32 core for LittleFS. Fix bug in examples for WT32_ETH01 + 1.8.0 K Hoang 31/12/2021 Fix `multiple-definitions` linker error + 1.9.0 K Hoang 20/01/2022 Make compatible to old code + 1.9.1 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards + 1.10.0 K Hoang 06/04/2022 Use Ethernet_Generic library as default. Add support to Portenta_H7 Ethernet and WiFi + 1.10.1 K Hoang 25/09/2022 Add support to `RP2040W` using `CYW43439 WiFi` with `arduino-pico` core + **********************************************************************************************************************************/ + +#pragma once + +#ifndef TIMEZONE_GENERIC_H +#define TIMEZONE_GENERIC_H + +#include "Timezone_Generic.hpp" +#include "Timezone_Generic_Impl.h" + +#endif // TIMEZONE_GENERIC_H