lcd_demo.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*================================================================
  2. Copyright (c) 2021, Quectel Wireless Solutions Co., Ltd. All rights reserved.
  3. Quectel Wireless Solutions Proprietary and Confidential.
  4. =================================================================*/
  5. /*=================================================================
  6. EDIT HISTORY FOR MODULE
  7. This section contains comments describing changes made to the module.
  8. Notice that changes are listed in reverse chronological order.
  9. WHEN WHO WHAT, WHERE, WHY
  10. ------------ ------- -------------------------------------------------------------------------------
  11. =================================================================*/
  12. /*===========================================================================
  13. * include files
  14. ===========================================================================*/
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include "ql_api_osi.h"
  19. #include "ql_log.h"
  20. #include "ql_gpio.h"
  21. #include "lcd_demo.h"
  22. /*===========================================================================
  23. * Macro Definition
  24. ===========================================================================*/
  25. #define QL_LCDDEMO_LOG_LEVEL QL_LOG_LEVEL_INFO
  26. #define QL_LCDDEMO_LOG(msg, ...) QL_LOG(QL_LCDDEMO_LOG_LEVEL, "ql_LCDDEMO", msg, ##__VA_ARGS__)
  27. #define QL_LCDDEMO_LOG_PUSH(msg, ...) QL_LOG_PUSH("ql_LCDDEMO", msg, ##__VA_ARGS__)
  28. #define BWSCREEN_TEST 0 //open test when set 1
  29. /*===========================================================================
  30. * Variate
  31. ===========================================================================*/
  32. //uint16_t rotation_flg = 0; // for rotation test
  33. #if !BWSCREEN_TEST
  34. uint16_t Test_image1[30*50] = {};
  35. uint16_t Test_image2[50*100] = {};
  36. uint16_t Test_image3[100*200] = {};
  37. #else
  38. uint8_t bmp[]={
  39. // 请
  40. 0x00,
  41. 0X20,0X22,0Xec,0X00,0X20,0X22,0Xaa,0Xaa,0Xaa,0Xbf,0Xaa,0Xaa,0Xeb,0Xa2,0X20,0X00,
  42. // 插
  43. 0X10,0X10,0X10,0Xff,0X90,0X24,0X24,0Xa4,0X24,0Xfc,0X22,0X23,0X22,0Xb0,0X20,0X00,
  44. // 入
  45. 0X00,0X00,0X00,0X00,0X00,0X01,0Xe2,0X1c,0Xe0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  46. //'U'
  47. 0Xfc,0Xfc,0X00,0X00,0X00,0Xfc,0Xfc,0X00,
  48. //'I'
  49. 0X00,0X00,0X04,0Xfc,0Xfc,0X04,0X00,0X00,
  50. //'M'
  51. 0Xfc,0Xfc,0X38,0X70,0X38,0Xfc,0Xfc,0X00,
  52. // 卡
  53. 0X40,0X40,0X40,0X40,0X40,0X40,0Xff,0X44,0X44,0X44,0X46,0X44,0X40,0X60,0X40,0X00,
  54. 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  55. 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  56. 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
  57. //请2
  58. //0x00,
  59. 0X00,0X00,0X7f,0X20,0X10,0X00,0Xff,0X0a,0X0a,0X0a,0X4a,0X8a,0X7f,0X00,0X00,0X00,
  60. //插2
  61. 0X02,0X42,0X81,0X7f,0X00,0Xff,0X49,0X48,0X40,0X7f,0X40,0X49,0X49,0Xff,0X01,0X00,
  62. //入2
  63. 0X80,0X40,0X20,0X10,0X0c,0X03,0X00,0X00,0X00,0X03,0X0c,0X30,0X40,0Xc0,0X40,0X00,
  64. //'U'2
  65. 0X07,0X0f,0X08,0X08,0X08,0X0f,0X07,0X00,
  66. //'I'2
  67. 0X00,0X00,0X08,0X0f,0X0f,0X08,0X00,0X00,
  68. //'M'2
  69. 0X0f,0X0f,0X00,0X00,0X00,0X0f,0X0f,0X00,
  70. // 卡2
  71. 0X00,0X00,0X00,0X00,0X00,0X00,0Xff,0X00,0X02,0X04,0X0c,0X18,0X00,0X00,0X00,0X00,
  72. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  73. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  74. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  75. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  76. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  77. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  78. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  79. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  80. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  81. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  82. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  83. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  84. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  85. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  86. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  87. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  88. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  89. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  90. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  91. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  92. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  93. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  94. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  95. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  96. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  97. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  98. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  99. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  100. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  101. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  102. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  103. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  104. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  105. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  106. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  107. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  108. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  109. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  110. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  111. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  112. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  113. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  114. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  115. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  116. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  117. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  118. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  119. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  120. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  121. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  122. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  123. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  124. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  125. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  126. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  127. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  128. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  129. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  130. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  131. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  132. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  133. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  134. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  135. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  136. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  137. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  138. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
  139. };
  140. #endif
  141. /*===========================================================================
  142. * Functions
  143. ===========================================================================*/
  144. #if !BWSCREEN_TEST
  145. void image_test_set(void)
  146. {
  147. uint16_t count = 0;
  148. uint16_t image1_len = sizeof(Test_image1)/sizeof(Test_image1[0]);
  149. uint16_t image2_len = sizeof(Test_image2)/sizeof(Test_image2[0]);
  150. uint16_t image3_len = sizeof(Test_image3)/sizeof(Test_image3[0]);
  151. for( count = 0; count < image1_len; count++ )
  152. {
  153. Test_image1[count] = LCD_BLACK;
  154. }
  155. for( count = 0; count < image2_len; count++ )
  156. {
  157. Test_image2[count] = LCD_YELLOW;
  158. }
  159. for( count = 0; count < image3_len; count++ )
  160. {
  161. Test_image3[count] = LCD_PURPLE;
  162. }
  163. }
  164. #else
  165. void ql_lcd_write_bmp(uint8_t *buffer)
  166. {
  167. uint8_t page, column;
  168. for( page = 0; page < 8; page++ )
  169. {
  170. ql_spi_lcd_write_cmd(0xb0+page); // from page0
  171. ql_spi_lcd_write_cmd(0x10); // from column0_high
  172. ql_spi_lcd_write_cmd(0x00); // from column0_low
  173. for( column = 0; column < 128; column++ )
  174. {
  175. ql_spi_lcd_write_data(*buffer++);
  176. }
  177. }
  178. }
  179. #endif
  180. static void ql_lcd_demo_thread(void *param)
  181. {
  182. QL_LCDDEMO_LOG("lcd demo thread enter, param 0x%x", param);
  183. ql_event_t event;
  184. ql_lcd_info_t lcd_info = {0};
  185. #if BWSCREEN_TEST
  186. ql_lcd_bw_info_t bw_info = {0};
  187. #endif
  188. //if you don't want clean screen in the initialization,you can use this API
  189. //ql_lcd_config_t config =
  190. //{
  191. // 0, //0--not rotating ,1--Rotate 90 degrees
  192. // 0, //width of display
  193. // QL_LCD_RGB565, //LCD format
  194. // false, //false -- clean screen ,true -- keep screen
  195. // QL_LCD_SPI_LINE_4, //busmode
  196. // 0, // use default frequence
  197. //};
  198. //config.clean_screen = true;
  199. //ql_lcd_set_config(&config);
  200. // befor/after lcd_init all OK!!!
  201. // 1. set the first two parameters when customer's LCD start pixel isn't (0,0)
  202. // 2. set the last two parameters when customer's LCD driver width&height is inconsistent with QL_driver
  203. // (less/greater than QL_driver, is positive/negative value)
  204. //ql_lcd_set_display_offset(2, 1, 10, 20);
  205. //before lcd_init set this API!!!
  206. //if busmode isn't SPI_LINE_4, set other busmode by this API.
  207. //ql_lcd_set_busmode(QL_LCD_SPI_LINE_3);
  208. #if !BWSCREEN_TEST
  209. if( ql_lcd_init() != QL_LCD_SUCCESS )
  210. #else
  211. bw_info.index = QL_LCD_BW_ST7567A;
  212. if( ql_lcd_init_bwscreen(bw_info) != QL_LCD_SUCCESS )
  213. #endif
  214. //if( ql_lcd_init_ext(LCD_BLACK, false) != QL_LCD_SUCCESS )
  215. {
  216. QL_LCDDEMO_LOG("LCD init failed");
  217. ql_rtos_task_delete(NULL);
  218. }
  219. // befor/after lcd_init all OK!!!
  220. //ql_lcd_set_display_offset(0, 0, -80, 80);
  221. ql_lcd_get_info(&lcd_info);
  222. QL_LCDDEMO_LOG("LCD ID[0x%x] w[%d] h[%d] bus[%d] freq[%d]", lcd_info.drv_id, lcd_info.width, lcd_info.height, lcd_info.bus_mode, lcd_info.freq);
  223. ql_lcd_config_t get_config = {0};
  224. ql_lcd_get_config(&get_config);
  225. QL_LCDDEMO_LOG("LCD get_config lcdrotation[%d] widthoriginal[%d] lcdcolorformat[%d] clean_screen[%d] bus[%d] freq[%d]", get_config.lcdrotation, get_config.widthoriginal, get_config.lcdcolorformat, get_config.clean_screen, get_config.bus_mode, get_config.freq);
  226. #if !BWSCREEN_TEST
  227. image_test_set();
  228. /* set backlight brightness, from level 1 to level 5 */
  229. ql_lcd_set_level_brightness(1, 0);
  230. ql_lcd_set_level_brightness(2, 7);
  231. ql_lcd_set_level_brightness(3, 15);
  232. ql_lcd_set_level_brightness(4, 31);
  233. ql_lcd_set_level_brightness(5, 63);
  234. //ql_lcd_set_brightness(5); //if ql_lcd_init_ext's second argument is false, need to set ql_lcd_set_brightness.
  235. #endif
  236. while(1)
  237. {
  238. ql_event_wait(&event, 1);
  239. #if !BWSCREEN_TEST
  240. #if 0 // for rotation test
  241. if( rotation_flg == 0)
  242. {
  243. ql_lcd_clear_screen(LCD_RED);
  244. ql_rtos_task_sleep_s(5);
  245. ql_lcd_set_display_offset(0, 0, 0, 0);
  246. ql_spi_lcd_write_cmd(0x36);
  247. ql_spi_lcd_write_data(0x00);
  248. ql_lcd_clear_screen(LCD_GREEN);
  249. ql_rtos_task_sleep_s(5);
  250. rotation_flg = 1;
  251. }
  252. else
  253. {
  254. ql_lcd_clear_screen(LCD_YELLOW);
  255. ql_rtos_task_sleep_s(5);
  256. ql_lcd_set_display_offset(0, 0, -80, 80);
  257. ql_spi_lcd_write_cmd(0x36);
  258. ql_spi_lcd_write_data(0xC0);
  259. ql_lcd_clear_screen(LCD_BLUE);
  260. ql_rtos_task_sleep_s(5);
  261. rotation_flg = 0;
  262. }
  263. /* block display BLACK */
  264. ql_lcd_write(Test_image1, 20, 20, 50-1, 70-1);
  265. ql_rtos_task_sleep_s(5);
  266. #else
  267. /* display on */
  268. ql_lcd_display_on();
  269. QL_LCDDEMO_LOG("LCD display on");
  270. ql_rtos_task_sleep_s(1);
  271. /* full screen RED */
  272. ql_lcd_clear_screen(LCD_RED);
  273. ql_rtos_task_sleep_s(5);
  274. /* block display BLACK */
  275. ql_lcd_write(Test_image1, 20, 20, 50-1, 70-1);
  276. ql_rtos_task_sleep_s(5);
  277. /* full screen GREEN */
  278. ql_lcd_clear_screen(LCD_GREEN);
  279. ql_rtos_task_sleep_s(5);
  280. /* block display YELLOW */
  281. ql_lcd_write(Test_image2, 50, 50, 100-1, 150-1);
  282. ql_rtos_task_sleep_s(5);
  283. /* LCD enter sleep*/
  284. /* if the lcd has been initialized, the function must be called before enter sleep*/
  285. ql_lcd_enter_sleep(true);
  286. QL_LCDDEMO_LOG("LCD enter sleep");
  287. ql_rtos_task_sleep_s(10);
  288. /* LCD exit sleep*/
  289. ql_lcd_enter_sleep(false);
  290. QL_LCDDEMO_LOG("LCD exit sleep");
  291. /* full screen BLUE */
  292. ql_lcd_clear_screen(LCD_BLUE);
  293. ql_rtos_task_sleep_s(5);
  294. /* block display PURPLE */
  295. ql_lcd_write(Test_image3, 100, 100, 200-1, 300-1);
  296. ql_rtos_task_sleep_s(5);
  297. /* rotation 90 display */
  298. ql_spi_lcd_write_cmd(0x36);
  299. ql_spi_lcd_write_data(0x60);
  300. ql_lcd_write(Test_image1, 70, 100, 100-1, 150-1);
  301. ql_rtos_task_sleep_s(3);
  302. /* normal display */
  303. ql_spi_lcd_write_cmd(0x36);
  304. ql_spi_lcd_write_data(0x00);
  305. ql_lcd_write(Test_image2, 120, 150, 170-1, 250-1);
  306. ql_rtos_task_sleep_s(3);
  307. /* full screen WHITE */
  308. ql_lcd_clear_screen(LCD_WHITE);
  309. /* brightness adjust */
  310. ql_lcd_set_brightness(0);
  311. QL_LCDDEMO_LOG("LCD backlight 0");
  312. ql_rtos_task_sleep_s(3);
  313. ql_lcd_set_brightness(1);
  314. QL_LCDDEMO_LOG("LCD backlight 1");
  315. ql_rtos_task_sleep_s(3);
  316. ql_lcd_set_brightness(2);
  317. QL_LCDDEMO_LOG("LCD backlight 2");
  318. ql_rtos_task_sleep_s(3);
  319. ql_lcd_set_brightness(3);
  320. QL_LCDDEMO_LOG("LCD backlight 3");
  321. ql_rtos_task_sleep_s(3);
  322. ql_lcd_set_brightness(4);
  323. QL_LCDDEMO_LOG("LCD backlight 4");
  324. ql_rtos_task_sleep_s(3);
  325. ql_lcd_set_brightness(5);
  326. QL_LCDDEMO_LOG("LCD backlight 5");
  327. ql_rtos_task_sleep_s(3);
  328. /* display off */
  329. ql_lcd_display_off();
  330. QL_LCDDEMO_LOG("LCD display off");
  331. ql_rtos_task_sleep_s(1);
  332. #endif
  333. #else
  334. ql_lcd_write_bmp(bmp);
  335. ql_rtos_task_sleep_s(10);
  336. #endif
  337. }
  338. ql_rtos_task_delete(NULL);
  339. }
  340. void ql_lcd_app_init(void)
  341. {
  342. QlOSStatus err = QL_OSI_SUCCESS;
  343. ql_task_t lcd_task = NULL;
  344. err = ql_rtos_task_create(&lcd_task, 1024, APP_PRIORITY_NORMAL, "ql_lcddemo", ql_lcd_demo_thread, NULL, 1);
  345. if( err != QL_OSI_SUCCESS )
  346. {
  347. QL_LCDDEMO_LOG("lcd demo task created failed");
  348. }
  349. }