rt-thread-official/bsp/stm32/stm32l475-atk-pandora/applications/lcd_sample.c

49 lines
1.0 KiB
C

/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* 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)
{
/* 清屏 */
lcd_clear(WHITE);
/* 显示 RT-Thread logo */
lcd_show_image(0, 0, 240, 69, image_rttlogo);
/* 设置背景色和前景色 */
lcd_set_color(WHITE, BLACK);
/* 在 LCD 上显示字符 */
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");
/* 在 LCD 上画线 */
lcd_draw_line(0, 69+16+24+32, 240, 69+16+24+32);
/* 在 LCD 上画一个同心圆 */
lcd_draw_point(120, 194);
for (int i = 0; i < 46; i += 4)
{
lcd_draw_circle(120, 194, i);
}
return RT_EOK;
}
INIT_APP_EXPORT(lcd_sample);
#endif /* BSP_USING_SPI_LCD */