esp_lcd_panel_io_interface.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #include "esp_lcd_panel_io.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. typedef struct esp_lcd_panel_io_t esp_lcd_panel_io_t; /*!< Type of LCD panel IO */
  14. /**
  15. * @brief LCD panel IO interface
  16. */
  17. struct esp_lcd_panel_io_t {
  18. /**
  19. * @brief Transmit LCD command and receive corresponding parameters
  20. *
  21. * @note This is the panel-specific interface called by function `esp_lcd_panel_io_rx_param()`.
  22. *
  23. * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
  24. * @param[in] lcd_cmd The specific LCD command, set to -1 if no command needed
  25. * @param[out] param Buffer for the command data
  26. * @param[in] param_size Size of `param` buffer
  27. * @return
  28. * - ESP_ERR_INVALID_ARG if parameter is invalid
  29. * - ESP_ERR_NOT_SUPPORTED if read is not supported by transport
  30. * - ESP_OK on success
  31. */
  32. esp_err_t (*rx_param)(esp_lcd_panel_io_t *io, int lcd_cmd, void *param, size_t param_size);
  33. /**
  34. * @brief Transmit LCD command and corresponding parameters
  35. *
  36. * @note This is the panel-specific interface called by function `esp_lcd_panel_io_tx_param()`.
  37. *
  38. * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
  39. * @param[in] lcd_cmd The specific LCD command
  40. * @param[in] param Buffer that holds the command specific parameters, set to NULL if no parameter is needed for the command
  41. * @param[in] param_size Size of `param` in memory, in bytes, set to zero if no parameter is needed for the command
  42. * @return
  43. * - ESP_ERR_INVALID_ARG if parameter is invalid
  44. * - ESP_OK on success
  45. */
  46. esp_err_t (*tx_param)(esp_lcd_panel_io_t *io, int lcd_cmd, const void *param, size_t param_size);
  47. /**
  48. * @brief Transmit LCD RGB data
  49. *
  50. * @note This is the panel-specific interface called by function `esp_lcd_panel_io_tx_color()`.
  51. *
  52. * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
  53. * @param[in] lcd_cmd The specific LCD command
  54. * @param[in] color Buffer that holds the RGB color data
  55. * @param[in] color_size Size of `color` in memory, in bytes
  56. * @return
  57. * - ESP_ERR_INVALID_ARG if parameter is invalid
  58. * - ESP_OK on success
  59. */
  60. esp_err_t (*tx_color)(esp_lcd_panel_io_t *io, int lcd_cmd, const void *color, size_t color_size);
  61. /**
  62. * @brief Destory LCD panel IO handle (deinitialize all and free resource)
  63. *
  64. * @param[in] io LCD panel IO handle, which is created by other factory API like `esp_lcd_new_panel_io_spi()`
  65. * @return
  66. * - ESP_ERR_INVALID_ARG if parameter is invalid
  67. * - ESP_OK on success
  68. */
  69. esp_err_t (*del)(esp_lcd_panel_io_t *io);
  70. /**
  71. * @brief Register LCD panel IO callbacks
  72. *
  73. * @param[in] io LCD panel IO handle, which is created by factory API like `esp_lcd_new_panel_io_spi()`
  74. * @param[in] cbs structure with all LCD panel IO callbacks
  75. * @param[in] user_ctx User private data, passed directly to callback's user_ctx
  76. * @return
  77. * - ESP_ERR_INVALID_ARG if parameter is invalid
  78. * - ESP_OK on success
  79. */
  80. esp_err_t (*register_event_callbacks)(esp_lcd_panel_io_t *io, const esp_lcd_panel_io_callbacks_t *cbs, void *user_ctx);
  81. };
  82. #ifdef __cplusplus
  83. }
  84. #endif