to applications

This commit is contained in:
2024-07-29 12:03:36 +08:00
parent cbe5266c25
commit 3c5707f097
4 changed files with 0 additions and 0 deletions

15
applications/SConscript Normal file
View File

@@ -0,0 +1,15 @@
from building import *
import os
cwd = GetCurrentDir()
CPPPATH = [cwd]
src = Glob('*.c')
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')

50
applications/app_lcd.c Normal file
View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-07-08 Nino the first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include <drv_lcd.h>
void app_lcd_string(void){
lcd_clear(WHITE);
/* set the background color and foreground color */
lcd_set_color(WHITE, BLACK);
/* show some string on 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");
/* draw a line on lcd */
lcd_draw_line(0, 69 + 16 + 24 + 32, 240, 69 + 16 + 24 + 32);
rt_kprintf("string lcd\n");
}
void app_lcd_circle(void){
/* draw a concentric circles */
lcd_draw_point(120, 194);
for (int i = 0; i < 46; i += 4)
{
lcd_draw_circle(120, 194, i);
}
rt_kprintf("circle lcd\n");
}
void app_lcd_clean(void){
lcd_clear(WHITE);
rt_kprintf("clean lcd\n");
}
MSH_CMD_EXPORT(app_lcd_string, show string on LCD);
MSH_CMD_EXPORT(app_lcd_circle, show circle on LCD);
MSH_CMD_EXPORT(app_lcd_clean, clean LCD);

52
applications/main.c Normal file
View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-5-10 ShiHao first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#define DBG_TAG "main"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
#include <drv_lcd.h>
#include <rttlogo.h>
/* 配置 LED 灯引脚 */
#define PIN_LED_B GET_PIN(F, 11) // PF11 : LED_B --> LED
#define PIN_LED_R GET_PIN(F, 12) // PF12 : LED_R --> LED
int main(void)
{
// lcd_clear(WHITE);
// /* show RT-Thread logo */
// lcd_show_image(0, 0, 240, 69, image_rttlogo);
// /* set the background color and foreground color */
// lcd_set_color(WHITE, BLACK);
// /* show some string on 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");
// /* draw a line on lcd */
// lcd_draw_line(0, 69 + 16 + 24 + 32, 240, 69 + 16 + 24 + 32);
// /* draw a concentric circles */
// lcd_draw_point(120, 194);
// for (int i = 0; i < 46; i += 4)
// {
// lcd_draw_circle(120, 194, i);
// }
return 0;
}

2072
applications/rttlogo.h Normal file

File diff suppressed because it is too large Load Diff