ql_boot_lcd.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /** @file
  2. ql_boot_lcd.h
  3. @brief
  4. This file is used to define boot lcd api for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. 08/12/2020 Neo Init version
  17. =================================================================*/
  18. #ifndef QL_BOOT_LCD_H
  19. #define QL_BOOT_LCD_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*===========================================================================
  24. * Macro Definition
  25. ===========================================================================*/
  26. #define QL_BOOT_LCD_ERRCODE_BASE (0x8209<<16)
  27. #define LCD_RED 0xf800
  28. #define LCD_GREEN 0x07e0
  29. #define LCD_BLUE 0x001f
  30. #define LCD_WHITE 0xffff
  31. #define LCD_BLACK 0x0000
  32. #define LCD_YELLOW 0xffe0
  33. #define LCD_PURPLE 0xf81f
  34. /*===========================================================================
  35. * Enum
  36. ===========================================================================*/
  37. typedef enum
  38. {
  39. QL_BOOT_LCD_SUCCESS = 0,
  40. QL_BOOT_LCD_EXECUTE_ERR = 1|QL_BOOT_LCD_ERRCODE_BASE,
  41. QL_BOOT_LCD_INVALID_PARAM_ERR,
  42. QL_BOOT_LCD_INIT_ERR,
  43. QL_BOOT_LCD_BUFFER_CREATE_ERR,
  44. QL_BOOT_LCD_BLOCK_SET_ERR,
  45. QL_BOOT_LCD_OPERATION_ERR
  46. }ql_boot_errcode_lcd;
  47. typedef enum
  48. {
  49. QL_BOOT_LCD_RGB565 = 2, // don't change name&num
  50. QL_BOOT_LCD_YUV422_YUYV = 9,
  51. QL_BOOT_LCD_RESOLUTION_MAX
  52. }ql_boot_lcd_resolution_s;
  53. /**
  54. * LCD bus mode
  55. */
  56. typedef enum
  57. {
  58. QL_BOOT_LCD_SPI_LINE_4 = 0,
  59. QL_BOOT_LCD_SPI_LINE_3 = 1,
  60. QL_BOOT_LCD_SPI_LINE_3_2_LANE = 3,
  61. QL_BOOT_LCD_SPI_LINE_MAX
  62. }ql_boot_lcd_busmode_s;
  63. /*===========================================================================
  64. * Struct
  65. ===========================================================================*/
  66. typedef struct
  67. {
  68. uint8_t index;
  69. } ql_boot_lcd_bw_info_t;
  70. typedef struct
  71. {
  72. uint16_t lcdrotation; //LCD rotation
  73. uint16_t widthoriginal; //width of display
  74. ql_boot_lcd_resolution_s lcdcolorformat; //LCD color format
  75. bool clean_screen; //clean_screen
  76. ql_boot_lcd_busmode_s bus_mode; // driver busmode
  77. uint32_t freq; // driver frequence
  78. } ql_boot_lcd_config_t;
  79. /*===========================================================================
  80. * Functions declaration
  81. ===========================================================================*/
  82. /**
  83. * @brief Init the LCD moudle
  84. * @return
  85. * QL_BOOT_LCD_INIT_ERR
  86. * QL_BOOT_LCD_BUFFER_CREATE_ERR
  87. * QL_BOOT_LCD_BLOCK_SET_ERR
  88. * QL_BOOT_LCD_SUCCESS
  89. */
  90. ql_boot_errcode_lcd ql_boot_lcd_init(void);
  91. /**
  92. * @brief Clear screen background to a kind of color
  93. * @param color : background color
  94. * @return
  95. * QL_BOOT_LCD_BLOCK_SET_ERR
  96. * QL_BOOT_LCD_SUCCESS
  97. */
  98. ql_boot_errcode_lcd ql_boot_lcd_clear_screen(uint16_t color);
  99. /**
  100. * @brief LCD part area set
  101. * @param buffer : write-in data buffer
  102. * @param start_x : horizontal coordinate x start location
  103. * @param start_y : vertical coordinate y start location
  104. * @param end_x : horizontal coordinate x end location
  105. * @param end_x : vertical coordinate y end location
  106. * @return
  107. * QL_BOOT_LCD_INVALID_PARAM_ERR
  108. * QL_BOOT_LCD_BLOCK_SET_ERR
  109. * QL_BOOT_LCD_SUCCESS
  110. */
  111. ql_boot_errcode_lcd ql_boot_lcd_write(uint16_t *buffer, uint16_t start_x, uint16_t start_y, uint16_t end_x, uint16_t end_y);
  112. /**
  113. * @brief LCD display turn on
  114. * @return
  115. * QL_BOOT_LCD_OPERATION_ERR
  116. * QL_BOOT_LCD_SUCCESS
  117. */
  118. ql_boot_errcode_lcd ql_boot_lcd_display_on(void);
  119. /**
  120. * @brief LCD display turn off
  121. * @return
  122. * QL_BOOT_LCD_OPERATION_ERR
  123. * QL_BOOT_LCD_SUCCESS
  124. */
  125. ql_boot_errcode_lcd ql_boot_lcd_display_off(void);
  126. /**
  127. * @brief LCD backlight brightness one channel set function
  128. * @param level_brightness : range is 0~63, one step is 0.84mA
  129. * one channel current: mix is 1.68mA, max is 54.6mA
  130. * there is 4 channels
  131. * total current is (1.68 + 0.84 * level_brightness) * 4 (mA)
  132. * @return
  133. * QL_BOOT_LCD_INVALID_PARAM_ERR
  134. * QL_BOOT_LCD_SUCCESS
  135. */
  136. ql_boot_errcode_lcd ql_boot_lcd_set_level_brightness(uint8_t level_brightness);
  137. /**
  138. * @brief LCD SPI CMD send interface
  139. * @param cmd : LCD SPI CMD param
  140. * @return
  141. * QL_BOOT_LCD_INVALID_PARAM_ERR
  142. * QL_BOOT_LCD_SUCCESS
  143. */
  144. ql_boot_errcode_lcd ql_boot_spi_lcd_write_cmd(uint8_t cmd);
  145. /**
  146. * @brief LCD SPI DATA send interface
  147. * @param data : LCD SPI DATA param
  148. * @return
  149. * QL_BOOT_LCD_INVALID_PARAM_ERR
  150. * QL_BOOT_LCD_SUCCESS
  151. */
  152. ql_boot_errcode_lcd ql_boot_spi_lcd_write_data(uint8_t data);
  153. /**
  154. * @brief LCD display area set
  155. * @param start_x_offset : start pixel's x_offset (distance from (0,0) in x)
  156. * @param start_y_offset : start pixel's y_offset (distance from (0,0) in y)
  157. * @param width_offset : width's x_offset (the diff between the supported width in driver and the width user want)
  158. * @param height_offset : height's y_offset (the diff between the supported height in driver and the height user want)
  159. * when less than the supported width/height, offset is positive value;
  160. * when greater than the supported width/height, offset is negative value.
  161. * @return
  162. * QL_BOOT_LCD_EXECUTE_ERR
  163. * QL_BOOT_LCD_BUFFER_CREATE_ERR
  164. * QL_BOOT_LCD_SUCCESS
  165. * @notice!!!
  166. * The next configuration clears the last configured offset.
  167. */
  168. ql_boot_errcode_lcd ql_boot_lcd_set_display_offset(uint16_t start_x_offset, uint16_t start_y_offset, int16_t width_offset, int16_t height_offset);
  169. /**
  170. * @brief Customer set LCD configure value
  171. * rotation/colorformat/widthoriginal/clean_screen/drv bus_mode/drv freq
  172. * @param *config :
  173. * rotation -- 0:not rotating 1:rotate 90
  174. * widthoriginal -- Width of landscape screen
  175. * colorformat -- QL_LCD_YUV422_UYVY QL_LCD_RGB565
  176. * clean_screen -- false: clean screen true: keep screen
  177. * bus_mode -- Line4/Line3/Line3_2lane
  178. * freq -- 0 means use default driver frequence
  179. * @return
  180. * QL_LCD_SUCCESS
  181. */
  182. ql_boot_errcode_lcd ql_boot_lcd_set_config(ql_boot_lcd_config_t *config);
  183. /**
  184. * @brief Init the LCD bwscreen driver
  185. * @param bw_info
  186. * .index : this index is equal to the index of ql_lcd_bwscreen_tab in drv_lcd_cfg.c
  187. * @return
  188. * QL_BOOT_LCD_INIT_ERR
  189. * QL_BOOT_LCD_BUFFER_CREATE_ERR
  190. * QL_BOOT_LCD_BLOCK_SET_ERR
  191. * QL_BOOT_LCD_SUCCESS
  192. */
  193. ql_boot_errcode_lcd ql_boot_lcd_init_bwscreen(ql_boot_lcd_bw_info_t bw_info);
  194. #ifdef __cplusplus
  195. } /*"C" */
  196. #endif
  197. #endif /* QL_BOOT_LCD_H */