Merge branch 'fix/lcd_build_error_in_cpp_v5.2' into 'release/v5.2'

fix(lcd): build errors with deprecated lcd types in cpp (v5.2)

See merge request espressif/esp-idf!31677
This commit is contained in:
morris
2024-06-25 10:50:12 +08:00
6 changed files with 147 additions and 39 deletions
+49 -15
View File
@@ -210,21 +210,6 @@ esp_err_t esp_lcd_new_panel_io_i2c_v1(uint32_t bus, const esp_lcd_panel_io_i2c_c
*/
esp_err_t esp_lcd_new_panel_io_i2c_v2(i2c_master_bus_handle_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io);
/**
* @brief Create LCD panel IO handle
*
* @param[in] bus I2C bus handle
* @param[in] io_config IO configuration, for I2C interface
* @param[out] ret_io Returned IO handle
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
#define esp_lcd_new_panel_io_i2c(bus, io_config, ret_io) _Generic((bus), \
i2c_master_bus_handle_t : esp_lcd_new_panel_io_i2c_v2, \
default : esp_lcd_new_panel_io_i2c_v1) (bus, io_config, ret_io) \
#if SOC_LCD_I80_SUPPORTED
/**
* @brief LCD Intel 8080 bus configuration structure
@@ -309,3 +294,52 @@ esp_err_t esp_lcd_new_panel_io_i80(esp_lcd_i80_bus_handle_t bus, const esp_lcd_p
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
/**
* @brief Create LCD panel IO handle
*
* @param[in] bus I2C bus ID, indicates which I2C port to use
* @param[in] io_config IO configuration, for I2C interface
* @param[out] ret_io Returned IO handle
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
static inline void esp_lcd_new_panel_io_i2c(uint32_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
{
esp_lcd_new_panel_io_i2c_v1(bus, io_config, ret_io);
}
/**
* @brief Create LCD panel IO handle
*
* @param[in] bus I2C bus handle, returned from `i2c_new_master_bus`
* @param[in] io_config IO configuration, for I2C interface
* @param[out] ret_io Returned IO handle
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
static inline void esp_lcd_new_panel_io_i2c(i2c_master_bus_handle_t bus, const esp_lcd_panel_io_i2c_config_t *io_config, esp_lcd_panel_io_handle_t *ret_io)
{
esp_lcd_new_panel_io_i2c_v2(bus, io_config, ret_io);
}
#else
/**
* @brief Create LCD panel IO handle
*
* @param[in] bus I2C bus handle
* @param[in] io_config IO configuration, for I2C interface
* @param[out] ret_io Returned IO handle
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NO_MEM if out of memory
* - ESP_OK on success
*/
#define esp_lcd_new_panel_io_i2c(bus, io_config, ret_io) _Generic((bus), \
i2c_master_bus_handle_t : esp_lcd_new_panel_io_i2c_v2, \
default : esp_lcd_new_panel_io_i2c_v1) (bus, io_config, ret_io)
#endif
@@ -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 */
+8 -13
View File
@@ -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
-5
View File
@@ -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
*/