2019-08-28 13:44:27 +08:00
|
|
|
/*
|
2021-03-14 15:33:55 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2019-08-28 13:44:27 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2019-08-28 WillianChan first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <rtdevice.h>
|
|
|
|
#include <board.h>
|
|
|
|
|
|
|
|
#ifdef BSP_USING_SPI_LCD
|
|
|
|
#include <drv_lcd.h>
|
|
|
|
#include <rttlogo.h>
|
|
|
|
|
|
|
|
static int lcd_sample(void)
|
|
|
|
{
|
2021-03-14 15:33:55 +08:00
|
|
|
/* 清屏 */
|
2019-08-28 13:44:27 +08:00
|
|
|
lcd_clear(WHITE);
|
|
|
|
|
2021-03-14 15:33:55 +08:00
|
|
|
/* 显示 RT-Thread logo */
|
2019-08-28 13:44:27 +08:00
|
|
|
lcd_show_image(0, 0, 240, 69, image_rttlogo);
|
2021-03-14 15:33:55 +08:00
|
|
|
|
|
|
|
/* 设置背景色和前景色 */
|
2019-08-28 13:44:27 +08:00
|
|
|
lcd_set_color(WHITE, BLACK);
|
|
|
|
|
2021-03-14 15:33:55 +08:00
|
|
|
/* 在 LCD 上显示字符 */
|
2019-08-28 13:44:27 +08:00
|
|
|
lcd_show_string(10, 69, 16, "Hello, RT-Thread!");
|
|
|
|
lcd_show_string(10, 69+16, 24, "RT-Thread");
|
|
|
|
lcd_show_string(10, 69+16+24, 32, "RT-Thread");
|
2021-03-14 15:33:55 +08:00
|
|
|
|
|
|
|
/* 在 LCD 上画线 */
|
2019-08-28 13:44:27 +08:00
|
|
|
lcd_draw_line(0, 69+16+24+32, 240, 69+16+24+32);
|
2021-03-14 15:33:55 +08:00
|
|
|
|
|
|
|
/* 在 LCD 上画一个同心圆 */
|
2019-08-28 13:44:27 +08:00
|
|
|
lcd_draw_point(120, 194);
|
|
|
|
for (int i = 0; i < 46; i += 4)
|
|
|
|
{
|
|
|
|
lcd_draw_circle(120, 194, i);
|
|
|
|
}
|
2021-03-14 15:33:55 +08:00
|
|
|
|
2019-08-28 13:44:27 +08:00
|
|
|
return RT_EOK;
|
|
|
|
}
|
|
|
|
INIT_APP_EXPORT(lcd_sample);
|
|
|
|
#endif /* BSP_USING_SPI_LCD */
|