lcd_sample.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2019-08-28 WillianChan first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <board.h>
  13. #ifdef BSP_USING_SPI_LCD
  14. #include <drv_lcd.h>
  15. #include <rttlogo.h>
  16. static int lcd_sample(void)
  17. {
  18. /* 清屏 */
  19. lcd_clear(WHITE);
  20. /* 显示 RT-Thread logo */
  21. lcd_show_image(0, 0, 240, 69, image_rttlogo);
  22. /* 设置背景色和前景色 */
  23. lcd_set_color(WHITE, BLACK);
  24. /* 在 LCD 上显示字符 */
  25. lcd_show_string(10, 69, 16, "Hello, RT-Thread!");
  26. lcd_show_string(10, 69+16, 24, "RT-Thread");
  27. lcd_show_string(10, 69+16+24, 32, "RT-Thread");
  28. /* 在 LCD 上画线 */
  29. lcd_draw_line(0, 69+16+24+32, 240, 69+16+24+32);
  30. /* 在 LCD 上画一个同心圆 */
  31. lcd_draw_point(120, 194);
  32. for (int i = 0; i < 46; i += 4)
  33. {
  34. lcd_draw_circle(120, 194, i);
  35. }
  36. return RT_EOK;
  37. }
  38. INIT_APP_EXPORT(lcd_sample);
  39. #endif /* BSP_USING_SPI_LCD */