esp_lcd_panel_io_interface.h 3.1 KB

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