1 /*
2  * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #pragma once
7 
8 #include <stdbool.h>
9 #include "esp_err.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef struct esp_lcd_panel_io_t esp_lcd_panel_io_t; /*!< Type of LCD panel IO */
16 
17 /**
18  * @brief LCD panel IO interface
19  */
20 struct esp_lcd_panel_io_t {
21     /**
22      * @brief Transmit LCD command and corresponding parameters
23      *
24      * @note This is the panel-specific interface called by function `esp_lcd_panel_io_tx_param()`.
25      *
26      * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
27      * @param[in] lcd_cmd The specific LCD command
28      * @param[in] param Buffer that holds the command specific parameters, set to NULL if no parameter is needed for the command
29      * @param[in] param_size Size of `param` in memory, in bytes, set to zero if no parameter is needed for the command
30      * @return
31      *          - ESP_ERR_INVALID_ARG   if parameter is invalid
32      *          - ESP_OK                on success
33      */
34     esp_err_t (*tx_param)(esp_lcd_panel_io_t *io, int lcd_cmd, const void *param, size_t param_size);
35 
36     /**
37      * @brief Transmit LCD RGB data
38      *
39      * @note This is the panel-specific interface called by function `esp_lcd_panel_io_tx_color()`.
40      *
41      * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
42      * @param[in] lcd_cmd The specific LCD command
43      * @param[in] color Buffer that holds the RGB color data
44      * @param[in] color_size Size of `color` in memory, in bytes
45      * @return
46      *          - ESP_ERR_INVALID_ARG   if parameter is invalid
47      *          - ESP_OK                on success
48      */
49     esp_err_t (*tx_color)(esp_lcd_panel_io_t *io, int lcd_cmd, const void *color, size_t color_size);
50 
51     /**
52      * @brief Destory LCD panel IO handle (deinitialize all and free resource)
53      *
54      * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
55      * @return
56      *          - ESP_ERR_INVALID_ARG   if parameter is invalid
57      *          - ESP_OK                on success
58      */
59     esp_err_t (*del)(esp_lcd_panel_io_t *io);
60 };
61 
62 #ifdef __cplusplus
63 }
64 #endif
65