From c1114a01c6a505a4498e396351e17975ff4ca5b5 Mon Sep 17 00:00:00 2001 From: Liu Zhongwei Date: Sat, 18 May 2024 17:03:19 +0800 Subject: [PATCH] feat(config): add version control for all configuration files by @lzw655 (#32) --- CHANGELOG.md | 6 + ESP_Panel_Board_Custom.h | 15 ++ ESP_Panel_Board_Supported.h | 17 +- ESP_Panel_Conf.h | 15 ++ examples/LCD/3wireSPI_RGB/ESP_Panel_Conf.h | 15 ++ examples/LCD/QSPI/ESP_Panel_Conf.h | 15 ++ examples/LCD/RGB/ESP_Panel_Conf.h | 15 ++ examples/LCD/SPI/ESP_Panel_Conf.h | 15 ++ .../LVGL/v8/Porting/ESP_Panel_Board_Custom.h | 15 ++ .../v8/Porting/ESP_Panel_Board_Supported.h | 17 +- examples/LVGL/v8/Porting/ESP_Panel_Conf.h | 15 ++ .../LVGL/v8/Rotation/ESP_Panel_Board_Custom.h | 15 ++ .../v8/Rotation/ESP_Panel_Board_Supported.h | 17 +- examples/LVGL/v8/Rotation/ESP_Panel_Conf.h | 15 ++ .../Panel/PanelTest/ESP_Panel_Board_Custom.h | 15 ++ .../PanelTest/ESP_Panel_Board_Supported.h | 17 +- examples/Panel/PanelTest/ESP_Panel_Conf.h | 15 ++ .../v8/Porting/ESP_Panel_Board_Custom.h | 15 ++ .../v8/Porting/ESP_Panel_Board_Supported.h | 17 +- .../SquareLine/v8/Porting/ESP_Panel_Conf.h | 15 ++ .../v8/WiFiClock/ESP_Panel_Board_Custom.h | 15 ++ .../v8/WiFiClock/ESP_Panel_Board_Supported.h | 17 +- .../SquareLine/v8/WiFiClock/ESP_Panel_Conf.h | 15 ++ examples/Touch/I2C/ESP_Panel_Conf.h | 15 ++ examples/Touch/SPI/ESP_Panel_Conf.h | 15 ++ library.properties | 2 +- src/ESP_Panel.cpp | 5 +- src/ESP_Panel.h | 8 +- src/ESP_PanelVersions.h | 84 ++++++++ src/ESP_Panel_Board_Internal.h | 171 ++++++++++++---- src/ESP_Panel_Conf_Internal.h | 189 +++++++----------- src/ESP_Panel_Library.h | 5 + src/board/ESP_PanelBoard.h | 55 +++++ 33 files changed, 721 insertions(+), 176 deletions(-) create mode 100644 src/ESP_PanelVersions.h create mode 100644 src/board/ESP_PanelBoard.h diff --git a/CHANGELOG.md b/CHANGELOG.md index 4586a279..4c9dc095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # ChangeLog +## v0.1.3 - 2024-05-26 + +### Enhancements: + +* feat(config): add version control for all configuration files by @lzw655 (#32) + ## v0.1.2 - 2024-05-17 ### Bugfixes: diff --git a/ESP_Panel_Board_Custom.h b/ESP_Panel_Board_Custom.h index 8ca14043..7e4dc5d3 100644 --- a/ESP_Panel_Board_Custom.h +++ b/ESP_Panel_Board_Custom.h @@ -349,6 +349,21 @@ // #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) // #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ // *INDENT-OFF* diff --git a/ESP_Panel_Board_Supported.h b/ESP_Panel_Board_Supported.h index b98eedce..dda0d913 100644 --- a/ESP_Panel_Board_Supported.h +++ b/ESP_Panel_Board_Supported.h @@ -12,7 +12,7 @@ #if ESP_PANEL_USE_SUPPORTED_BOARD /** * Uncomment one of the following macros to select an supported development board. If multiple macros are uncommented - * simultaneously, only the first one will take effect. + * at the same time, an error will be prompted during compilation. * */ @@ -56,4 +56,19 @@ */ // #define BOARD_ESP32_4848S040C_I_Y_3 +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Supported.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. If the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif diff --git a/ESP_Panel_Conf.h b/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/ESP_Panel_Conf.h +++ b/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/LCD/3wireSPI_RGB/ESP_Panel_Conf.h b/examples/LCD/3wireSPI_RGB/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/LCD/3wireSPI_RGB/ESP_Panel_Conf.h +++ b/examples/LCD/3wireSPI_RGB/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/LCD/QSPI/ESP_Panel_Conf.h b/examples/LCD/QSPI/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/LCD/QSPI/ESP_Panel_Conf.h +++ b/examples/LCD/QSPI/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/LCD/RGB/ESP_Panel_Conf.h b/examples/LCD/RGB/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/LCD/RGB/ESP_Panel_Conf.h +++ b/examples/LCD/RGB/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/LCD/SPI/ESP_Panel_Conf.h b/examples/LCD/SPI/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/LCD/SPI/ESP_Panel_Conf.h +++ b/examples/LCD/SPI/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h b/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h index 8ca14043..7e4dc5d3 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Board_Custom.h @@ -349,6 +349,21 @@ // #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) // #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ // *INDENT-OFF* diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h index b98eedce..dda0d913 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Board_Supported.h @@ -12,7 +12,7 @@ #if ESP_PANEL_USE_SUPPORTED_BOARD /** * Uncomment one of the following macros to select an supported development board. If multiple macros are uncommented - * simultaneously, only the first one will take effect. + * at the same time, an error will be prompted during compilation. * */ @@ -56,4 +56,19 @@ */ // #define BOARD_ESP32_4848S040C_I_Y_3 +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Supported.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. If the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif diff --git a/examples/LVGL/v8/Porting/ESP_Panel_Conf.h b/examples/LVGL/v8/Porting/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/LVGL/v8/Porting/ESP_Panel_Conf.h +++ b/examples/LVGL/v8/Porting/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h index 8ca14043..7e4dc5d3 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Custom.h @@ -349,6 +349,21 @@ // #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) // #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ // *INDENT-OFF* diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h index b98eedce..dda0d913 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Board_Supported.h @@ -12,7 +12,7 @@ #if ESP_PANEL_USE_SUPPORTED_BOARD /** * Uncomment one of the following macros to select an supported development board. If multiple macros are uncommented - * simultaneously, only the first one will take effect. + * at the same time, an error will be prompted during compilation. * */ @@ -56,4 +56,19 @@ */ // #define BOARD_ESP32_4848S040C_I_Y_3 +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Supported.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. If the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif diff --git a/examples/LVGL/v8/Rotation/ESP_Panel_Conf.h b/examples/LVGL/v8/Rotation/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/LVGL/v8/Rotation/ESP_Panel_Conf.h +++ b/examples/LVGL/v8/Rotation/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h b/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h index 8ca14043..7e4dc5d3 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h +++ b/examples/Panel/PanelTest/ESP_Panel_Board_Custom.h @@ -349,6 +349,21 @@ // #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) // #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ // *INDENT-OFF* diff --git a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h index b98eedce..dda0d913 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h +++ b/examples/Panel/PanelTest/ESP_Panel_Board_Supported.h @@ -12,7 +12,7 @@ #if ESP_PANEL_USE_SUPPORTED_BOARD /** * Uncomment one of the following macros to select an supported development board. If multiple macros are uncommented - * simultaneously, only the first one will take effect. + * at the same time, an error will be prompted during compilation. * */ @@ -56,4 +56,19 @@ */ // #define BOARD_ESP32_4848S040C_I_Y_3 +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Supported.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. If the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif diff --git a/examples/Panel/PanelTest/ESP_Panel_Conf.h b/examples/Panel/PanelTest/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/Panel/PanelTest/ESP_Panel_Conf.h +++ b/examples/Panel/PanelTest/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h index 8ca14043..7e4dc5d3 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Custom.h @@ -349,6 +349,21 @@ // #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) // #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ // *INDENT-OFF* diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h index b98eedce..dda0d913 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Board_Supported.h @@ -12,7 +12,7 @@ #if ESP_PANEL_USE_SUPPORTED_BOARD /** * Uncomment one of the following macros to select an supported development board. If multiple macros are uncommented - * simultaneously, only the first one will take effect. + * at the same time, an error will be prompted during compilation. * */ @@ -56,4 +56,19 @@ */ // #define BOARD_ESP32_4848S040C_I_Y_3 +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Supported.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. If the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif diff --git a/examples/SquareLine/v8/Porting/ESP_Panel_Conf.h b/examples/SquareLine/v8/Porting/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/SquareLine/v8/Porting/ESP_Panel_Conf.h +++ b/examples/SquareLine/v8/Porting/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h index 8ca14043..7e4dc5d3 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Custom.h @@ -349,6 +349,21 @@ // #define ESP_PANEL_BEGIN_BACKLIGHT_END_FUNCTION( panel ) // #define ESP_PANEL_BEGIN_END_FUNCTION( panel ) +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 + #endif /* ESP_PANEL_USE_CUSTOM_BOARD */ // *INDENT-OFF* diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h index b98eedce..dda0d913 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Board_Supported.h @@ -12,7 +12,7 @@ #if ESP_PANEL_USE_SUPPORTED_BOARD /** * Uncomment one of the following macros to select an supported development board. If multiple macros are uncommented - * simultaneously, only the first one will take effect. + * at the same time, an error will be prompted during compilation. * */ @@ -56,4 +56,19 @@ */ // #define BOARD_ESP32_4848S040C_I_Y_3 +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Supported.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. If the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 + #endif diff --git a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Conf.h b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/SquareLine/v8/WiFiClock/ESP_Panel_Conf.h +++ b/examples/SquareLine/v8/WiFiClock/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/Touch/I2C/ESP_Panel_Conf.h b/examples/Touch/I2C/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/Touch/I2C/ESP_Panel_Conf.h +++ b/examples/Touch/I2C/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/examples/Touch/SPI/ESP_Panel_Conf.h b/examples/Touch/SPI/ESP_Panel_Conf.h index 1758b2c4..07e7d69c 100644 --- a/examples/Touch/SPI/ESP_Panel_Conf.h +++ b/examples/Touch/SPI/ESP_Panel_Conf.h @@ -58,3 +58,18 @@ * */ #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (0) // 0/1 + +/** + * Do not change the following versions, they are used to check if the configurations in this file are compatible with + * the current version of `ESP_Panel_Board_Custom.h` in the library. The detailed rules are as follows: + * + * 1. If the major version is not consistent, then the configurations in this file are incompatible with the library + * and must be replaced with the file from the library. + * 2. If the minor version is not consistent, this file might be missing some new configurations, which will be set to + * default values. It is recommended to replace it with the file from the library. + * 3. Even if the patch version is not consistent, it will not affect normal functionality. + * + */ +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 diff --git a/library.properties b/library.properties index 68a7f205..ff8c0046 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ESP32_Display_Panel -version=0.1.2 +version=0.1.3 author=espressif maintainer=espressif sentence=ESP32_Display_Panel is an Arduino library designed for ESP SoCs to drive display panels and facilitate rapid GUI development. diff --git a/src/ESP_Panel.cpp b/src/ESP_Panel.cpp index 04df6f0c..30cc9704 100644 --- a/src/ESP_Panel.cpp +++ b/src/ESP_Panel.cpp @@ -4,15 +4,12 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "ESP_Panel_Conf_Internal.h" +#include "ESP_Panel_Library.h" #ifdef ESP_PANEL_USE_BOARD #include #include -#include "ESP_PanelLog.h" #include "driver/gpio.h" -#include -#include "ESP_Panel_Library.h" using namespace std; diff --git a/src/ESP_Panel.h b/src/ESP_Panel.h index 1ba60b72..479866c9 100644 --- a/src/ESP_Panel.h +++ b/src/ESP_Panel.h @@ -5,16 +5,10 @@ */ #pragma once -#include "ESP_Panel_Conf_Internal.h" +#include "ESP_Panel_Library.h" #ifdef ESP_PANEL_USE_BOARD #include -#include -#include "host/ESP_PanelHost.h" -#include "bus/ESP_PanelBus.h" -#include "lcd/ESP_PanelLcd.h" -#include "touch/ESP_PanelTouch.h" -#include "backlight/ESP_PanelBacklight.h" /** * @brief Panel device class diff --git a/src/ESP_PanelVersions.h b/src/ESP_PanelVersions.h new file mode 100644 index 00000000..0bdc7833 --- /dev/null +++ b/src/ESP_PanelVersions.h @@ -0,0 +1,84 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "ESP_Panel_Conf_Internal.h" +#include "ESP_Panel_Board_Internal.h" + +/* Library Version */ +#define ESP_PANEL_VERSION_MAJOR 0 +#define ESP_PANEL_VERSION_MINOR 1 +#define ESP_PANEL_VERSION_PATCH 3 + +/* File `ESP_Panel_Conf.h` */ +#define ESP_PANEL_CONF_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_VERSION_MINOR 1 +#define ESP_PANEL_CONF_VERSION_PATCH 0 + +/* File `ESP_Panel_Board_Custom.h` */ +#define ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_VERSION_PATCH 0 + +/* File `ESP_Panel_Board_Supported.h` */ +#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_VERSION_PATCH 0 + +/* Check if the current configuration file version is compatible with the library version */ +// File `ESP_Panel_Conf.h` +// If the version is not defined, set it to `0.1.0` +#if !defined(ESP_PANEL_CONF_FILE_VERSION_MAJOR) && \ + !defined(ESP_PANEL_CONF_FILE_VERSION_MINOR) && \ + !defined(ESP_PANEL_CONF_FILE_VERSION_PATCH) +#define ESP_PANEL_CONF_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_CONF_FILE_VERSION_MINOR 1 +#define ESP_PANEL_CONF_FILE_VERSION_PATCH 0 +#endif +// Check if the current configuration file version is compatible with the library version +#if ESP_PANEL_CONF_FILE_VERSION_MAJOR != ESP_PANEL_CONF_VERSION_MAJOR +#error "The file `ESP_Panel_Conf.h` version is not compatible. Please update it with the file from the library" +#elif ESP_PANEL_CONF_FILE_VERSION_MINOR < ESP_PANEL_CONF_VERSION_MINOR +#warning "The file `ESP_Panel_Conf.h` version is outdated. Some new configurations might be missing" +#endif /* ESP_PANEL_CONF_INCLUDE_INSIDE */ + +// File `ESP_Panel_Board_Custom.h` & `ESP_Panel_Board_Supported.h` +#ifdef ESP_PANEL_USE_BOARD +/* For using a supported board */ +#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD +// If the version is not defined, set it to `0.1.0` +#if !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR) && \ + !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR) && \ + !defined(ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH) +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_PATCH 0 +#endif +// Check if the current configuration file version is compatible with the library version +#if ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MAJOR != ESP_PANEL_BOARD_SUPPORTED_VERSION_MAJOR +#error "The file `ESP_Panel_Board_Supported.h` version is not compatible. Please update it with the file from the library" +#elif ESP_PANEL_BOARD_SUPPORTED_FILE_VERSION_MINOR < ESP_PANEL_BOARD_SUPPORTED_VERSION_MINOR +#warning "The file `ESP_Panel_Board_Supported.h` version is outdated. Some new configurations might be missing" +#endif + +#else /* For using a custom board */ + +// If the version is not defined, set it to `0.1.0` +#if !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR) && \ + !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR) && \ + !defined(ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH) +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR 0 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR 1 +#define ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_PATCH 0 +#endif +// Check if the current configuration file version is compatible with the library version +#if ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MAJOR != ESP_PANEL_BOARD_CUSTOM_VERSION_MAJOR +#error "The file `ESP_Panel_Board_Custom.h` version is not compatible. Please update it with the file from the library" +#elif ESP_PANEL_BOARD_CUSTOM_FILE_VERSION_MINOR < ESP_PANEL_BOARD_CUSTOM_VERSION_MINOR +#warning "The file `ESP_Panel_Board_Custom.h` version is outdated. Some new configurations might be missing" +#endif +#endif /* CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD */ +#endif /* ESP_PANEL_USE_BOARD */ diff --git a/src/ESP_Panel_Board_Internal.h b/src/ESP_Panel_Board_Internal.h index ed023797..2d394cc0 100644 --- a/src/ESP_Panel_Board_Internal.h +++ b/src/ESP_Panel_Board_Internal.h @@ -8,48 +8,139 @@ // *INDENT-OFF* -// Check if multiple boards are enabled -#if defined(BOARD_ESP32_C3_LCDKIT) + defined(BOARD_ESP32_S3_BOX) + defined(BOARD_ESP32_S3_BOX_3) + \ - defined(BOARD_ESP32_S3_BOX_3_BETA) + defined(BOARD_ESP32_S3_BOX_LITE) + defined(BOARD_ESP32_S3_EYE) + \ - defined(BOARD_ESP32_S3_KORVO_2) + defined(BOARD_ESP32_S3_LCD_EV_BOARD) + \ - defined(BOARD_ESP32_S3_LCD_EV_BOARD_V1_5) + defined(BOARD_ESP32_S3_LCD_EV_BOARD_2) + \ - defined(BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5) + defined(BOARD_ESP32_S3_USB_OTG) + \ - defined(BOARD_ESP32_4848S040C_I_Y_3) \ - > 1 - #error "Multiple boards enabled! Please check file `ESP_Panel_Board_Supported.h` and make sure only one board is enabled." +/* Handle special Kconfig options */ +#ifndef ESP_PANEL_KCONFIG_IGNORE + #include "sdkconfig.h" + #ifdef CONFIG_ESP_PANEL_CONF_SKIP + #define ESP_PANEL_CONF_SKIP + #endif #endif -// Include board specific header file -/* Espressif */ -#if defined(BOARD_ESP32_C3_LCDKIT) || CONFIG_BOARD_ESP32_C3_LCDKIT - #include "board/espressif/ESP32_C3_LCDKIT.h" -#elif defined(BOARD_ESP32_S3_BOX) || CONFIG_BOARD_ESP32_S3_BOX - #include "board/espressif/ESP32_S3_BOX.h" -#elif defined(BOARD_ESP32_S3_BOX_3) || CONFIG_BOARD_ESP32_S3_BOX_3 - #include "board/espressif/ESP32_S3_BOX_3.h" -#elif defined(BOARD_ESP32_S3_BOX_3_BETA) || CONFIG_BOARD_ESP32_S3_BOX_3_BETA - #include "board/espressif/ESP32_S3_BOX_3_BETA.h" -#elif defined(BOARD_ESP32_S3_BOX_LITE) || CONFIG_BOARD_ESP32_S3_BOX_LITE - #include "board/espressif/ESP32_S3_BOX_LITE.h" -#elif defined(BOARD_ESP32_S3_EYE) || CONFIG_BOARD_ESP32_S3_EYE - #include "board/espressif/ESP32_S3_EYE.h" -#elif defined(BOARD_ESP32_S3_KORVO_2) || CONFIG_BOARD_ESP32_S3_KORVO_2 - #include "board/espressif/ESP32_S3_KORVO_2.h" -#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD - #include "board/espressif/ESP32_S3_LCD_EV_BOARD.h" -#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD_V1_5) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 - #include "board/espressif/ESP32_S3_LCD_EV_BOARD_V1_5.h" -#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD_2) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2 - #include "board/espressif/ESP32_S3_LCD_EV_BOARD_2.h" -#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 - #include "board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h" -#elif defined(BOARD_ESP32_S3_USB_OTG) || CONFIG_BOARD_ESP32_S3_USB_OTG - #include "board/espressif/ESP32_S3_USB_OTG.h" -/* Jingcai */ -#elif defined(BOARD_ESP32_4848S040C_I_Y_3) || CONFIG_BOARD_ESP32_4848S040C_I_Y_3 - #include "board/jingcai/ESP32_4848S040C_I_Y_3.h" -#else - #error "Unkonw board selected! Please check file `ESP_Panel_Board_Supported.h` and make sure only one board is enabled." +/* If "ESP_Panel_*_Board.h" are available from here, try to use them later */ +#ifdef __has_include + #if __has_include("ESP_Panel_Board_Supported.h") + #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE + #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE + #endif + #elif __has_include("../../ESP_Panel_Board_Supported.h") + #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE + #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE + #endif + #endif + #if __has_include("ESP_Panel_Board_Custom.h") + #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE + #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE + #endif + #elif __has_include("../../ESP_Panel_Board_Custom.h") + #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE + #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE + #endif + #endif #endif +/* If "ESP_Panel_Board_*.h" are not skipped, include them */ +#ifndef ESP_PANEL_CONF_SKIP + #ifdef ESP_PANEL_SUPPORTED_BOARD_PATH /* If there is a path defined for "ESP_Panel_Board_Supported.h", use it */ + #define __TO_STR_AUX(x) #x + #define __TO_STR(x) __TO_STR_AUX(x) + #include __TO_STR(ESP_PANEL_SUPPORTED_BOARD_PATH) + #undef __TO_STR_AUX + #undef __TO_STR + #elif defined(ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE) /* Or simply include if "ESP_Panel_Board_Supported.h" is available */ + #include "ESP_Panel_Board_Supported.h" + #elif defined(ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE) /* Or include if "../../ESP_Panel_Board_Supported.h" is available */ + #include "../../ESP_Panel_Board_Supported.h" + #endif + #ifdef ESP_PANEL_CUSTOM_BOARD_PATH /* If there is a path defined for "ESP_Panel_Board_Custom.h" use it */ + #define __TO_STR_AUX(x) #x + #define __TO_STR(x) __TO_STR_AUX(x) + #include __TO_STR(ESP_PANEL_CUSTOM_BOARD_PATH) + #undef __TO_STR_AUX + #undef __TO_STR + #elif defined(ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE) /* Or simply include if "ESP_Panel_Board_Custom.h" is available */ + #include "ESP_Panel_Board_Custom.h" + #elif defined(ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE) /* Or include if "../../ESP_Panel_Board_Custom.h" is available */ + #include "../../ESP_Panel_Board_Custom.h" + #endif +#endif + +/* Check if select both custom and supported board */ +#if (CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD) && \ + (CONFIG_ESP_PANEL_USE_CUSTOM_BOARD || ESP_PANEL_USE_CUSTOM_BOARD) + #error "Please select either a custom or a supported development board, cannot enable both simultaneously" +#endif + +/* Check if use board */ +#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD || \ + CONFIG_ESP_PANEL_USE_CUSTOM_BOARD || ESP_PANEL_USE_CUSTOM_BOARD + #define ESP_PANEL_USE_BOARD +#endif + +#ifdef ESP_PANEL_USE_BOARD +/* For using a supported board */ +#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD +// Include the supported board header file +#include "board/ESP_PanelBoard.h" +#endif + +#include "ESP_PanelTypes.h" + +/* Define some special macros for devices */ +/*-------------------------------- LCD Related --------------------------------*/ +#if ESP_PANEL_USE_LCD + #if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + + #include "hal/spi_types.h" + #define ESP_PANEL_LCD_BUS_NAME SPI + #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) + + #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI + + #include "hal/spi_types.h" + #define ESP_PANEL_LCD_BUS_NAME QSPI + #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) + + #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB + + #ifndef SOC_LCD_RGB_SUPPORTED + #error "LCD RGB is only supported for ESP32-S3, please select the correct board." + #endif + #define ESP_PANEL_LCD_BUS_NAME RGB + #define ESP_PANEL_LCD_BUS_HOST (-1) + + #else + + #error "Unkonw LCD panel bus type selected, please refer to the README for supported bus types" + + #endif /* ESP_PANEL_LCD_BUS_TYPE */ +#endif /* ESP_PANEL_USE_LCD */ +/*-------------------------------- Touch Related --------------------------------*/ +#if ESP_PANEL_USE_TOUCH + #if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C + + #include "hal/i2c_types.h" + #define ESP_PANEL_TOUCH_BUS_NAME I2C + #define ESP_PANEL_TOUCH_BUS_HOST ((i2c_port_t)ESP_PANEL_TOUCH_BUS_HOST_ID) + + #elif ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI + + #include "hal/spi_types.h" + #define ESP_PANEL_TOUCH_BUS_NAME SPI + #define ESP_PANEL_TOUCH_BUS_HOST ((spi_host_device_t)ESP_PANEL_TOUCH_BUS_HOST_ID) + + #else + + #error "Unkonw Touch bus type selected, please refer to the README for supported bus types." + + #endif /* ESP_PANEL_TOUCH_BUS_TYPE */ +#endif /* ESP_PANEL_USE_TOUCH */ +/*-------------------------------- IO Expander Related --------------------------------*/ +#if ESP_PANEL_USE_EXPANDER + + #include "hal/i2c_types.h" + #define ESP_PANEL_EXPANDER_HOST ((i2c_port_t)ESP_PANEL_EXPANDER_HOST_ID) + +#endif /* ESP_PANEL_USE_EXPANDER */ +#endif /* ESP_PANEL_USE_BOARD */ + // *INDENT-OFF* diff --git a/src/ESP_Panel_Conf_Internal.h b/src/ESP_Panel_Conf_Internal.h index 5ab67551..ea03cf2e 100644 --- a/src/ESP_Panel_Conf_Internal.h +++ b/src/ESP_Panel_Conf_Internal.h @@ -16,9 +16,7 @@ #endif #endif -#include "ESP_PanelTypes.h" - -/* If "ESP_Panel_Conf.h" and "ESP_Panel_*_Board.h" are available from here, try to use them later */ +/* If "ESP_Panel_Conf.h" is available from here, try to use it later */ #ifdef __has_include #if __has_include("ESP_Panel_Conf.h") #ifndef ESP_PANEL_CONF_INCLUDE_SIMPLE @@ -28,140 +26,95 @@ #ifndef ESP_PANEL_CONF_INCLUDE_OUTSIDE #define ESP_PANEL_CONF_INCLUDE_OUTSIDE #endif - #endif - - #if __has_include("ESP_Panel_Board_Supported.h") - #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE - #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE - #endif - #elif __has_include("../../ESP_Panel_Board_Supported.h") - #ifndef ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE - #define ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE - #endif - #endif - - #if __has_include("ESP_Panel_Board_Custom.h") - #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE - #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE - #endif - #elif __has_include("../../ESP_Panel_Board_Custom.h") - #ifndef ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE - #define ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE - #endif + #else + #define ESP_PANEL_CONF_INCLUDE_INSIDE #endif #endif -/* If "ESP_Panel_Conf.h" and "ESP_Panel_Board_*.h" are not skipped, include them */ +/* If "ESP_Panel_Conf.h" is not skipped, include it */ #ifndef ESP_PANEL_CONF_SKIP - #ifdef ESP_PANEL_CONF_PATH /* If there is a path defined for "ESP_Panel_Conf.h" use it */ + #ifdef ESP_PANEL_CONF_PATH /* If there is a path defined for "ESP_Panel_Conf.h" use it */ #define __TO_STR_AUX(x) #x #define __TO_STR(x) __TO_STR_AUX(x) #include __TO_STR(ESP_PANEL_CONF_PATH) #undef __TO_STR_AUX #undef __TO_STR - #elif defined(ESP_PANEL_CONF_INCLUDE_SIMPLE) /* Or simply include if "ESP_Panel_Conf.h" is available */ + #elif defined(ESP_PANEL_CONF_INCLUDE_SIMPLE) /* Or simply include if "ESP_Panel_Conf.h" is available */ #include "ESP_Panel_Conf.h" - #elif defined(ESP_PANEL_CONF_INCLUDE_OUTSIDE) - #include "../../ESP_Panel_Conf.h" /* Or include if "../../ESP_Panel_Conf.h" is available */ - #else - #include "../ESP_Panel_Conf.h" /* Or include internal configuration */ + #elif defined(ESP_PANEL_CONF_INCLUDE_OUTSIDE) /* Or include if "../../ESP_Panel_Conf.h" is available */ + #include "../../ESP_Panel_Conf.h" + #elif defined(ESP_PANEL_CONF_INCLUDE_INSIDE) /* Or include the default configuration */ + #include "../ESP_Panel_Conf.h" #endif +#endif - #ifdef ESP_PANEL_SUPPORTED_BOARD_PATH /* If there is a path defined for "ESP_Panel_Board_Supported.h" use it */ - #define __TO_STR_AUX(x) #x - #define __TO_STR(x) __TO_STR_AUX(x) - #include __TO_STR(ESP_PANEL_SUPPORTED_BOARD_PATH) - #undef __TO_STR_AUX - #undef __TO_STR - #elif defined(ESP_PANEL_SUPPORTED_BOARD_INCLUDE_SIMPLE) /* Or simply include if "ESP_Panel_Board_Supported.h" is available */ - #include "ESP_Panel_Board_Supported.h" - #elif defined(ESP_PANEL_SUPPORTED_BOARD_INCLUDE_OUTSIDE) /* Or include if "../../ESP_Panel_Board_Supported.h" is available */ - #include "../../ESP_Panel_Board_Supported.h" +#if !ESP_PANEL_CONF_INCLUDE_INSIDE +/* Supplement macro definitions based on sdkconfig, use default values if not defined */ +/*-------------------------------- Debug configurations --------------------------------*/ +#ifndef ESP_PANEL_CHECK_RESULT_ASSERT + #ifdef CONFIG_ESP_PANEL_CHECK_RESULT_ASSERT + #define ESP_PANEL_CHECK_RESULT_ASSERT CONFIG_ESP_PANEL_CHECK_RESULT_ASSERT + #else + #define ESP_PANEL_CHECK_RESULT_ASSERT (0) #endif - - #ifdef ESP_PANEL_CUSTOM_BOARD_PATH /* If there is a path defined for "ESP_Panel_Board_Custom.h" use it */ - #define __TO_STR_AUX(x) #x - #define __TO_STR(x) __TO_STR_AUX(x) - #include __TO_STR(ESP_PANEL_CUSTOM_BOARD_PATH) - #undef __TO_STR_AUX - #undef __TO_STR - #elif defined(ESP_PANEL_CUSTOM_BOARD_INCLUDE_SIMPLE) /* Or simply include if "ESP_Panel_Board_Custom.h" is available */ - #include "ESP_Panel_Board_Custom.h" - #elif defined(ESP_PANEL_CUSTOM_BOARD_INCLUDE_OUTSIDE) /* Or include if "../../ESP_Panel_Board_Custom.h" is available */ - #include "../../ESP_Panel_Board_Custom.h" +#endif +#ifndef ESP_PANEL_ENABLE_LOG + #ifdef CONFIG_ESP_PANEL_ENABLE_LOG + #define ESP_PANEL_ENABLE_LOG CONFIG_ESP_PANEL_ENABLE_LOG + #else + #define ESP_PANEL_ENABLE_LOG (0) #endif #endif - -#if (CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD) && \ - (CONFIG_ESP_PANEL_USE_CUSTOM_BOARD || ESP_PANEL_USE_CUSTOM_BOARD) - #error "Please select either a custom or a supported development board, cannot enable both simultaneously" +/*----------------------------- Touch driver configurations -----------------------------*/ +#ifndef ESP_PANEL_TOUCH_MAX_POINTS + #ifdef CONFIG_ESP_PANEL_TOUCH_MAX_POINTS + #define ESP_PANEL_TOUCH_MAX_POINTS CONFIG_ESP_PANEL_TOUCH_MAX_POINTS + #else + #define ESP_PANEL_TOUCH_MAX_POINTS (5) + #endif #endif - -#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD - #include "ESP_Panel_Board_Internal.h" +#ifndef ESP_PANEL_TOUCH_MAX_BUTTONS + #ifdef CONFIG_ESP_PANEL_TOUCH_MAX_BUTTONS + #define ESP_PANEL_TOUCH_MAX_BUTTONS CONFIG_ESP_PANEL_TOUCH_MAX_BUTTONS + #else + #define ESP_PANEL_TOUCH_MAX_BUTTONS (1) + #endif #endif - -#if CONFIG_ESP_PANEL_USE_SUPPORTED_BOARD || ESP_PANEL_USE_SUPPORTED_BOARD || \ - CONFIG_ESP_PANEL_USE_CUSTOM_BOARD || ESP_PANEL_USE_CUSTOM_BOARD - #define ESP_PANEL_USE_BOARD +#ifndef ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD + #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD + #define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD CONFIG_ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD + #else + #define ESP_PANEL_TOUCH_XPT2046_Z_THRESHOLD (400) + #endif #endif - -/*-------------------------------- LCD Related --------------------------------*/ -#if ESP_PANEL_USE_LCD - #if ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI - - #include "hal/spi_types.h" - #define ESP_PANEL_LCD_BUS_NAME SPI - #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) - - #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_QSPI - - #include "hal/spi_types.h" - #define ESP_PANEL_LCD_BUS_NAME QSPI - #define ESP_PANEL_LCD_BUS_HOST ((spi_host_device_t)ESP_PANEL_LCD_BUS_HOST_ID) - - #elif ESP_PANEL_LCD_BUS_TYPE == ESP_PANEL_BUS_TYPE_RGB - - #ifndef SOC_LCD_RGB_SUPPORTED - #error "LCD RGB is only supported for ESP32-S3, please select the correct board." - #endif - #define ESP_PANEL_LCD_BUS_NAME RGB - #define ESP_PANEL_LCD_BUS_HOST (-1) - +#ifndef ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE + #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE + #define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE CONFIG_ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE #else - - #error "Unkonw LCD panel bus type selected, please refer to the README for supported bus types" - - #endif /* ESP_PANEL_LCD_BUS_TYPE */ -#endif /* ESP_PANEL_USE_LCD */ - -/*-------------------------------- Touch Related --------------------------------*/ -#if ESP_PANEL_USE_TOUCH - #if ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_I2C - - #include "hal/i2c_types.h" - #define ESP_PANEL_TOUCH_BUS_NAME I2C - #define ESP_PANEL_TOUCH_BUS_HOST ((i2c_port_t)ESP_PANEL_TOUCH_BUS_HOST_ID) - - #elif ESP_PANEL_TOUCH_BUS_TYPE == ESP_PANEL_BUS_TYPE_SPI - - #include "hal/spi_types.h" - #define ESP_PANEL_TOUCH_BUS_NAME SPI - #define ESP_PANEL_TOUCH_BUS_HOST ((spi_host_device_t)ESP_PANEL_TOUCH_BUS_HOST_ID) - + #define ESP_PANEL_TOUCH_XPT2046_INTERRUPT_MODE (0) + #endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE + #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE + #define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE CONFIG_ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE #else - - #error "Unkonw Touch bus type selected, please refer to the README for supported bus types." - - #endif /* ESP_PANEL_TOUCH_BUS_TYPE */ -#endif /* ESP_PANEL_USE_TOUCH */ - -/*-------------------------------- IO Expander Related --------------------------------*/ -#if ESP_PANEL_USE_EXPANDER - - #include "hal/i2c_types.h" - #define ESP_PANEL_EXPANDER_HOST ((i2c_port_t)ESP_PANEL_EXPANDER_HOST_ID) - -#endif /* ESP_PANEL_USE_EXPANDER */ + #define ESP_PANEL_TOUCH_XPT2046_VREF_ON_MODE (0) + #endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS + #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS + #define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS CONFIG_ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS + #else + #define ESP_PANEL_TOUCH_XPT2046_CONVERT_ADC_TO_COORDS (1) + #endif +#endif +#ifndef ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING + #ifdef CONFIG_ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING + #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING CONFIG_ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING + #else + #define ESP_PANEL_TOUCH_XPT2046_ENABLE_LOCKING (1) + #endif +#endif +#endif // *INDENT-OFF* diff --git a/src/ESP_Panel_Library.h b/src/ESP_Panel_Library.h index 7e0f5c02..61229dff 100644 --- a/src/ESP_Panel_Library.h +++ b/src/ESP_Panel_Library.h @@ -7,8 +7,10 @@ /* Drivers */ #include "ESP_Panel_Conf_Internal.h" +#include "ESP_Panel_Board_Internal.h" #include "ESP_PanelLog.h" #include "ESP_PanelTypes.h" +#include "ESP_PanelVersions.h" /* Host */ #include "host/ESP_PanelHost.h" @@ -47,5 +49,8 @@ /* Backlight */ #include "backlight/ESP_PanelBacklight.h" +/* 3rd-party Libraries */ +#include "ESP_IOExpander_Library.h" + /* Panel */ #include "ESP_Panel.h" diff --git a/src/board/ESP_PanelBoard.h b/src/board/ESP_PanelBoard.h new file mode 100644 index 00000000..ed023797 --- /dev/null +++ b/src/board/ESP_PanelBoard.h @@ -0,0 +1,55 @@ +/* + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +// *INDENT-OFF* + +// Check if multiple boards are enabled +#if defined(BOARD_ESP32_C3_LCDKIT) + defined(BOARD_ESP32_S3_BOX) + defined(BOARD_ESP32_S3_BOX_3) + \ + defined(BOARD_ESP32_S3_BOX_3_BETA) + defined(BOARD_ESP32_S3_BOX_LITE) + defined(BOARD_ESP32_S3_EYE) + \ + defined(BOARD_ESP32_S3_KORVO_2) + defined(BOARD_ESP32_S3_LCD_EV_BOARD) + \ + defined(BOARD_ESP32_S3_LCD_EV_BOARD_V1_5) + defined(BOARD_ESP32_S3_LCD_EV_BOARD_2) + \ + defined(BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5) + defined(BOARD_ESP32_S3_USB_OTG) + \ + defined(BOARD_ESP32_4848S040C_I_Y_3) \ + > 1 + #error "Multiple boards enabled! Please check file `ESP_Panel_Board_Supported.h` and make sure only one board is enabled." +#endif + +// Include board specific header file +/* Espressif */ +#if defined(BOARD_ESP32_C3_LCDKIT) || CONFIG_BOARD_ESP32_C3_LCDKIT + #include "board/espressif/ESP32_C3_LCDKIT.h" +#elif defined(BOARD_ESP32_S3_BOX) || CONFIG_BOARD_ESP32_S3_BOX + #include "board/espressif/ESP32_S3_BOX.h" +#elif defined(BOARD_ESP32_S3_BOX_3) || CONFIG_BOARD_ESP32_S3_BOX_3 + #include "board/espressif/ESP32_S3_BOX_3.h" +#elif defined(BOARD_ESP32_S3_BOX_3_BETA) || CONFIG_BOARD_ESP32_S3_BOX_3_BETA + #include "board/espressif/ESP32_S3_BOX_3_BETA.h" +#elif defined(BOARD_ESP32_S3_BOX_LITE) || CONFIG_BOARD_ESP32_S3_BOX_LITE + #include "board/espressif/ESP32_S3_BOX_LITE.h" +#elif defined(BOARD_ESP32_S3_EYE) || CONFIG_BOARD_ESP32_S3_EYE + #include "board/espressif/ESP32_S3_EYE.h" +#elif defined(BOARD_ESP32_S3_KORVO_2) || CONFIG_BOARD_ESP32_S3_KORVO_2 + #include "board/espressif/ESP32_S3_KORVO_2.h" +#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD + #include "board/espressif/ESP32_S3_LCD_EV_BOARD.h" +#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD_V1_5) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_V1_5 + #include "board/espressif/ESP32_S3_LCD_EV_BOARD_V1_5.h" +#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD_2) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2 + #include "board/espressif/ESP32_S3_LCD_EV_BOARD_2.h" +#elif defined(BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5) || CONFIG_BOARD_ESP32_S3_LCD_EV_BOARD_2_V1_5 + #include "board/espressif/ESP32_S3_LCD_EV_BOARD_2_V1_5.h" +#elif defined(BOARD_ESP32_S3_USB_OTG) || CONFIG_BOARD_ESP32_S3_USB_OTG + #include "board/espressif/ESP32_S3_USB_OTG.h" +/* Jingcai */ +#elif defined(BOARD_ESP32_4848S040C_I_Y_3) || CONFIG_BOARD_ESP32_4848S040C_I_Y_3 + #include "board/jingcai/ESP32_4848S040C_I_Y_3.h" +#else + #error "Unkonw board selected! Please check file `ESP_Panel_Board_Supported.h` and make sure only one board is enabled." +#endif + +// *INDENT-OFF*