diff --git a/src/Arduino_DataBus.h b/src/Arduino_DataBus.h index 4f90886..e0e5bf1 100644 --- a/src/Arduino_DataBus.h +++ b/src/Arduino_DataBus.h @@ -143,7 +143,7 @@ typedef volatile ARDUINOGFX_PORT_t *PORTreg_t; #endif // !defined(LITTLE_FOOT_PRINT) #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #include #include #include @@ -229,7 +229,7 @@ struct lcd_panel_io_i80_t } flags; lcd_i80_trans_descriptor_t trans_pool[]; // Transaction pool }; -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) typedef enum diff --git a/src/databus/Arduino_ESP32LCD16.cpp b/src/databus/Arduino_ESP32LCD16.cpp index ae2d413..95e3ca3 100644 --- a/src/databus/Arduino_ESP32LCD16.cpp +++ b/src/databus/Arduino_ESP32LCD16.cpp @@ -5,7 +5,7 @@ #include "Arduino_ESP32LCD16.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #define WAIT_LCD_NOT_BUSY while (LCD_CAM.lcd_user.val & LCD_CAM_LCD_START) @@ -594,5 +594,5 @@ GFX_INLINE void Arduino_ESP32LCD16::CS_LOW(void) } } -#endif // #if defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/databus/Arduino_ESP32LCD16.h b/src/databus/Arduino_ESP32LCD16.h index 1b3b7a6..6c382bf 100644 --- a/src/databus/Arduino_ESP32LCD16.h +++ b/src/databus/Arduino_ESP32LCD16.h @@ -1,14 +1,9 @@ -/* - * start rewrite from: - * https://github.com/lovyan03/LovyanGFX/blob/master/src/lgfx/v0/platforms/LGFX_PARALLEL_ESP32.hpp - */ +#pragma once + #include "Arduino_DataBus.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) - -#ifndef _ARDUINO_ESP32LCD16_H_ -#define _ARDUINO_ESP32LCD16_H_ +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #ifndef LCD_MAX_PIXELS_AT_ONCE #define LCD_MAX_PIXELS_AT_ONCE 2046 @@ -99,7 +94,5 @@ class Arduino_ESP32LCD16 : public Arduino_DataBus }; }; -#endif // _ARDUINO_ESP32LCD16_H_ - -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/databus/Arduino_ESP32LCD8.cpp b/src/databus/Arduino_ESP32LCD8.cpp index 6638ea6..fc1e090 100644 --- a/src/databus/Arduino_ESP32LCD8.cpp +++ b/src/databus/Arduino_ESP32LCD8.cpp @@ -5,7 +5,7 @@ #include "Arduino_ESP32LCD8.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #define WAIT_LCD_NOT_BUSY while (LCD_CAM.lcd_user.val & LCD_CAM_LCD_START) @@ -744,5 +744,5 @@ GFX_INLINE void Arduino_ESP32LCD8::CS_LOW(void) } } -#endif // #if defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/databus/Arduino_ESP32LCD8.h b/src/databus/Arduino_ESP32LCD8.h index 89718ed..3ce852c 100644 --- a/src/databus/Arduino_ESP32LCD8.h +++ b/src/databus/Arduino_ESP32LCD8.h @@ -3,7 +3,7 @@ #include "Arduino_DataBus.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #ifndef LCD_MAX_PIXELS_AT_ONCE #define LCD_MAX_PIXELS_AT_ONCE 2046 @@ -82,5 +82,5 @@ class Arduino_ESP32LCD8 : public Arduino_DataBus }; }; -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/databus/Arduino_ESP32RGBPanel.cpp b/src/databus/Arduino_ESP32RGBPanel.cpp index 0f345f0..0115831 100644 --- a/src/databus/Arduino_ESP32RGBPanel.cpp +++ b/src/databus/Arduino_ESP32RGBPanel.cpp @@ -1,7 +1,7 @@ #include "Arduino_ESP32RGBPanel.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) Arduino_ESP32RGBPanel::Arduino_ESP32RGBPanel( int8_t de, int8_t vsync, int8_t hsync, int8_t pclk, @@ -129,5 +129,5 @@ uint16_t *Arduino_ESP32RGBPanel::getFrameBuffer(int16_t w, int16_t h) return (uint16_t *)_rgb_panel->fb; } -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/databus/Arduino_ESP32RGBPanel.h b/src/databus/Arduino_ESP32RGBPanel.h index 646f015..fb885b9 100644 --- a/src/databus/Arduino_ESP32RGBPanel.h +++ b/src/databus/Arduino_ESP32RGBPanel.h @@ -1,10 +1,9 @@ +#pragma once + #include "Arduino_DataBus.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) - -#ifndef _ARDUINO_ESP32RGBPANEL_H_ -#define _ARDUINO_ESP32RGBPANEL_H_ +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #include "esp_lcd_panel_io.h" #include "esp_lcd_panel_rgb.h" @@ -96,7 +95,5 @@ class Arduino_ESP32RGBPanel esp_rgb_panel_t *_rgb_panel; }; -#endif // _ARDUINO_ESP32RGBPANEL_H_ - -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/databus/Arduino_ESP32SPI.h b/src/databus/Arduino_ESP32SPI.h index 8999b09..aa35930 100644 --- a/src/databus/Arduino_ESP32SPI.h +++ b/src/databus/Arduino_ESP32SPI.h @@ -5,13 +5,13 @@ #if defined(ESP32) #include "soc/spi_struct.h" #if CONFIG_IDF_TARGET_ESP32S3 -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #include "driver/periph_ctrl.h" #else #include "esp_private/periph_ctrl.h" #endif #elif CONFIG_IDF_TARGET_ESP32C3 -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #include "driver/periph_ctrl.h" #else #include "esp_private/periph_ctrl.h" diff --git a/src/databus/Arduino_ESP32SPIDMA.h b/src/databus/Arduino_ESP32SPIDMA.h index 9975582..8726122 100644 --- a/src/databus/Arduino_ESP32SPIDMA.h +++ b/src/databus/Arduino_ESP32SPIDMA.h @@ -4,7 +4,9 @@ #if defined(ESP32) #include +#if (ESP_ARDUINO_VERSION_MAJOR >= 3) #include +#endif #ifndef ESP32SPIDMA_MAX_PIXELS_AT_ONCE #define ESP32SPIDMA_MAX_PIXELS_AT_ONCE 1024 diff --git a/src/display/Arduino_RGB_Display.cpp b/src/display/Arduino_RGB_Display.cpp index 7ad5416..e1f581f 100644 --- a/src/display/Arduino_RGB_Display.cpp +++ b/src/display/Arduino_RGB_Display.cpp @@ -1,7 +1,7 @@ #include "../Arduino_DataBus.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #include "../Arduino_GFX.h" #include "Arduino_RGB_Display.h" @@ -519,5 +519,5 @@ uint16_t *Arduino_RGB_Display::getFramebuffer() return _framebuffer; } -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) diff --git a/src/display/Arduino_RGB_Display.h b/src/display/Arduino_RGB_Display.h index 88110cd..4731914 100644 --- a/src/display/Arduino_RGB_Display.h +++ b/src/display/Arduino_RGB_Display.h @@ -1,10 +1,9 @@ +#pragma once + #include "../Arduino_DataBus.h" #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3) -#if (ESP_ARDUINO_VERSION_MAJOR < 3) - -#ifndef _ARDUINO_RGB_DISPLAY_H_ -#define _ARDUINO_RGB_DISPLAY_H_ +#if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #include "../Arduino_GFX.h" #include "../databus/Arduino_ESP32RGBPanel.h" @@ -2299,7 +2298,5 @@ class Arduino_RGB_Display : public Arduino_GFX private: }; -#endif // _ARDUINO_RGB_DISPLAY_H_ - -#endif // #if (ESP_ARDUINO_VERSION_MAJOR < 3) +#endif // #if (!defined(ESP_ARDUINO_VERSION_MAJOR)) || (ESP_ARDUINO_VERSION_MAJOR < 3) #endif // #if defined(ESP32) && (CONFIG_IDF_TARGET_ESP32S3)