esp_lcd_panel_ops.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * SPDX-FileCopyrightText: 2021 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_types.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @brief Reset LCD panel
  15. *
  16. * @note Panel reset must be called before attempting to initialize the panel using `esp_lcd_panel_init()`.
  17. *
  18. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  19. * @return
  20. * - ESP_OK on success
  21. */
  22. esp_err_t esp_lcd_panel_reset(esp_lcd_panel_handle_t panel);
  23. /**
  24. * @brief Initialize LCD panel
  25. *
  26. * @note Before calling this function, make sure the LCD panel has finished the `reset` stage by `esp_lcd_panel_reset()`.
  27. *
  28. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  29. * @return
  30. * - ESP_OK on success
  31. */
  32. esp_err_t esp_lcd_panel_init(esp_lcd_panel_handle_t panel);
  33. /**
  34. * @brief Deinitialize the LCD panel
  35. *
  36. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  37. * @return
  38. * - ESP_OK on success
  39. */
  40. esp_err_t esp_lcd_panel_del(esp_lcd_panel_handle_t panel);
  41. /**
  42. * @brief Draw bitmap on LCD panel
  43. *
  44. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  45. * @param[in] x_start Start index on x-axis (x_start included)
  46. * @param[in] y_start Start index on y-axis (y_start included)
  47. * @param[in] x_end End index on x-axis (x_end not included)
  48. * @param[in] y_end End index on y-axis (y_end not included)
  49. * @param[in] color_data RGB color data that will be dumped to the specific window range
  50. * @return
  51. * - ESP_OK on success
  52. */
  53. esp_err_t esp_lcd_panel_draw_bitmap(esp_lcd_panel_handle_t panel, int x_start, int y_start, int x_end, int y_end, const void *color_data);
  54. /**
  55. * @brief Mirror the LCD panel on specific axis
  56. *
  57. * @note Combined with `esp_lcd_panel_swap_xy()`, one can realize screen rotation
  58. *
  59. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  60. * @param[in] mirror_x Whether the panel will be mirrored about the x axis
  61. * @param[in] mirror_y Whether the panel will be mirrored about the y axis
  62. * @return
  63. * - ESP_OK on success
  64. * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
  65. */
  66. esp_err_t esp_lcd_panel_mirror(esp_lcd_panel_handle_t panel, bool mirror_x, bool mirror_y);
  67. /**
  68. * @brief Swap/Exchange x and y axis
  69. *
  70. * @note Combined with `esp_lcd_panel_mirror()`, one can realize screen rotation
  71. *
  72. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  73. * @param[in] swap_axes Whether to swap the x and y axis
  74. * @return
  75. * - ESP_OK on success
  76. * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
  77. */
  78. esp_err_t esp_lcd_panel_swap_xy(esp_lcd_panel_handle_t panel, bool swap_axes);
  79. /**
  80. * @brief Set extra gap in x and y axis
  81. *
  82. * The gap is the space (in pixels) between the left/top sides of the LCD panel and the first row/column respectively of the actual contents displayed.
  83. *
  84. * @note Setting a gap is useful when positioning or centering a frame that is smaller than the LCD.
  85. *
  86. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  87. * @param[in] x_gap Extra gap on x axis, in pixels
  88. * @param[in] y_gap Extra gap on y axis, in pixels
  89. * @return
  90. * - ESP_OK on success
  91. */
  92. esp_err_t esp_lcd_panel_set_gap(esp_lcd_panel_handle_t panel, int x_gap, int y_gap);
  93. /**
  94. * @brief Invert the color (bit-wise invert the color data line)
  95. *
  96. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  97. * @param[in] invert_color_data Whether to invert the color data
  98. * @return
  99. * - ESP_OK on success
  100. */
  101. esp_err_t esp_lcd_panel_invert_color(esp_lcd_panel_handle_t panel, bool invert_color_data);
  102. /**
  103. * @brief Turn off the display
  104. *
  105. * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st7789()`
  106. * @param[in] off Whether to turn off the screen
  107. * @return
  108. * - ESP_OK on success
  109. * - ESP_ERR_NOT_SUPPORTED if this function is not supported by the panel
  110. */
  111. esp_err_t esp_lcd_panel_disp_off(esp_lcd_panel_handle_t panel, bool off);
  112. #ifdef __cplusplus
  113. }
  114. #endif