mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(lcd): build errors with deprecated lcd types in cpp
Closes https://github.com/espressif/esp-idf/issues/14029
This commit is contained in:
parent
4570722409
commit
4e7dd0ce2b
@ -19,8 +19,8 @@ extern "C" {
|
||||
typedef struct {
|
||||
int reset_gpio_num; /*!< GPIO used to reset the LCD panel, set to -1 if it's not used */
|
||||
union {
|
||||
lcd_rgb_element_order_t color_space; /*!< @deprecated Set RGB color space, please use rgb_ele_order instead */
|
||||
lcd_rgb_element_order_t rgb_endian; /*!< @deprecated Set RGB data endian, please use rgb_ele_order instead */
|
||||
esp_lcd_color_space_t color_space; /*!< @deprecated Set RGB color space, please use rgb_ele_order instead */
|
||||
lcd_color_rgb_endian_t rgb_endian; /*!< @deprecated Set RGB data endian, please use rgb_ele_order instead */
|
||||
lcd_rgb_element_order_t rgb_ele_order; /*!< Set RGB element order, RGB or BGR */
|
||||
};
|
||||
lcd_rgb_data_endian_t data_endian; /*!< Set the data endian for color data larger than 1 byte */
|
||||
|
@ -16,20 +16,15 @@ typedef struct esp_lcd_panel_io_t *esp_lcd_panel_io_handle_t; /*!< Type of LCD p
|
||||
typedef struct esp_lcd_panel_t *esp_lcd_panel_handle_t; /*!< Type of LCD panel handle */
|
||||
|
||||
/** @cond */
|
||||
/**
|
||||
* @brief LCD color space type definition (WRONG!)
|
||||
* @deprecated RGB and BGR should belong to the same color space, but this enum take them both as two different color spaces.
|
||||
* If you want to use a enum to describe a color space, please use lcd_color_space_t instead.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_LCD_COLOR_SPACE_RGB, /*!< Color space: RGB */
|
||||
ESP_LCD_COLOR_SPACE_BGR, /*!< Color space: BGR */
|
||||
ESP_LCD_COLOR_SPACE_MONOCHROME, /*!< Color space: monochrome */
|
||||
} esp_lcd_color_space_t __attribute__((deprecated));
|
||||
/// for backward compatible
|
||||
typedef lcd_rgb_element_order_t lcd_color_rgb_endian_t;
|
||||
#define LCD_RGB_ENDIAN_RGB (lcd_color_rgb_endian_t)LCD_RGB_ELEMENT_ORDER_RGB
|
||||
#define LCD_RGB_ENDIAN_BGR (lcd_color_rgb_endian_t)LCD_RGB_ELEMENT_ORDER_BGR
|
||||
|
||||
// Ensure binary compatibility with lcd_color_rgb_endian_t
|
||||
ESP_STATIC_ASSERT((lcd_rgb_element_order_t)ESP_LCD_COLOR_SPACE_RGB == LCD_RGB_ELEMENT_ORDER_RGB, "ESP_LCD_COLOR_SPACE_RGB is not compatible with LCD_RGB_ORDER_RGB");
|
||||
ESP_STATIC_ASSERT((lcd_rgb_element_order_t)ESP_LCD_COLOR_SPACE_BGR == LCD_RGB_ELEMENT_ORDER_BGR, "ESP_LCD_COLOR_SPACE_BGR is not compatible with LCD_RGB_ORDER_BGR");
|
||||
typedef lcd_rgb_element_order_t esp_lcd_color_space_t;
|
||||
#define ESP_LCD_COLOR_SPACE_RGB (esp_lcd_color_space_t)LCD_RGB_ELEMENT_ORDER_RGB
|
||||
#define ESP_LCD_COLOR_SPACE_BGR (esp_lcd_color_space_t)LCD_RGB_ELEMENT_ORDER_BGR
|
||||
#define ESP_LCD_COLOR_SPACE_MONOCHROME (esp_lcd_color_space_t)2
|
||||
/** @endcond */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -28,11 +28,6 @@ typedef enum {
|
||||
LCD_RGB_ELEMENT_ORDER_BGR, /*!< RGB element order: BGR */
|
||||
} lcd_rgb_element_order_t;
|
||||
|
||||
/// for backward compatible
|
||||
typedef lcd_rgb_element_order_t lcd_color_rgb_endian_t;
|
||||
#define LCD_RGB_ENDIAN_RGB LCD_RGB_ELEMENT_ORDER_RGB
|
||||
#define LCD_RGB_ENDIAN_BGR LCD_RGB_ELEMENT_ORDER_BGR
|
||||
|
||||
/**
|
||||
* @brief RGB data endian
|
||||
*/
|
||||
|
@ -1,6 +1,12 @@
|
||||
idf_component_register(SRCS cxx_build_test_main.cpp
|
||||
test_soc_reg_macros.cpp
|
||||
test_cxx_standard.cpp
|
||||
set(srcs cxx_build_test_main.cpp
|
||||
test_soc_reg_macros.cpp
|
||||
test_cxx_standard.cpp)
|
||||
|
||||
if(CONFIG_SOC_I2C_SUPPORTED)
|
||||
list(APPEND srcs test_i2c_lcd.cpp)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS "${srcs}"
|
||||
INCLUDE_DIRS "."
|
||||
PRIV_REQUIRES driver
|
||||
PRIV_REQUIRES driver esp_lcd
|
||||
REQUIRES soc)
|
||||
|
39
tools/test_apps/system/cxx_build_test/main/test_i2c_lcd.cpp
Normal file
39
tools/test_apps/system/cxx_build_test/main/test_i2c_lcd.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include "esp_lcd_panel_vendor.h"
|
||||
|
||||
const esp_lcd_panel_dev_config_t panel_config0 = {
|
||||
.reset_gpio_num = 0,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_MONOCHROME,
|
||||
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
||||
.bits_per_pixel = 16,
|
||||
.flags = {
|
||||
.reset_active_high = false,
|
||||
},
|
||||
.vendor_config = NULL,
|
||||
};
|
||||
|
||||
const esp_lcd_panel_dev_config_t panel_config1 = {
|
||||
.reset_gpio_num = 0,
|
||||
.color_space = ESP_LCD_COLOR_SPACE_BGR,
|
||||
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
||||
.bits_per_pixel = 16,
|
||||
.flags = {
|
||||
.reset_active_high = false,
|
||||
},
|
||||
.vendor_config = NULL,
|
||||
};
|
||||
|
||||
const esp_lcd_panel_dev_config_t panel_config2 = {
|
||||
.reset_gpio_num = 0,
|
||||
.rgb_endian = LCD_RGB_ENDIAN_BGR,
|
||||
.data_endian = LCD_RGB_DATA_ENDIAN_LITTLE,
|
||||
.bits_per_pixel = 16,
|
||||
.flags = {
|
||||
.reset_active_high = false,
|
||||
},
|
||||
.vendor_config = NULL,
|
||||
};
|
Loading…
Reference in New Issue
Block a user