feat: add log related files.

This commit is contained in:
ShallowGreen123
2022-09-21 23:33:18 +08:00
parent e39d9e53b8
commit a1144bbba8
11 changed files with 133 additions and 18 deletions

View File

@@ -0,0 +1 @@
DisFormate : true

View File

@@ -1,7 +1,10 @@
{
"files.associations": {
"scr_mgr.h": "c",
"gui_main_scr.h": "c"
"gui_main_scr.h": "c",
"stdio.h": "c",
"gui_log.h": "c",
"lvgl.h": "c"
},
"C_Cpp.errorSquiggles": "Disabled"
}

View File

@@ -55,6 +55,8 @@
<ClCompile Include="LVGL.Simulator.cpp" />
<ClCompile Include="lvgl_mydemo\data\dataModel.c" />
<ClCompile Include="lvgl_mydemo\data\scr_mgr.c" />
<ClCompile Include="lvgl_mydemo\log\drv_log.c" />
<ClCompile Include="lvgl_mydemo\log\gui_log.c" />
<ClCompile Include="lvgl_mydemo\lvgl_app.c" />
<ClCompile Include="lvgl_mydemo\screen\gui_main_scr.c" />
<ClCompile Include="lvgl_mydemo\screen\gui_scr_mgr.c" />

View File

@@ -48,6 +48,12 @@
<ClCompile Include="lvgl_mydemo\screen\gui_test1_scr.c">
<Filter>lvgl_mydemo\srceen</Filter>
</ClCompile>
<ClCompile Include="lvgl_mydemo\log\gui_log.c">
<Filter>lvgl_mydemo\log</Filter>
</ClCompile>
<ClCompile Include="lvgl_mydemo\log\drv_log.c">
<Filter>lvgl_mydemo\log</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LVGL.Simulator.rc" />
@@ -80,5 +86,8 @@
<Filter Include="lvgl_mydemo\assert\image">
<UniqueIdentifier>{5aec906d-b671-4778-9999-6dcadc840600}</UniqueIdentifier>
</Filter>
<Filter Include="lvgl_mydemo\log">
<UniqueIdentifier>{7c5bcdd0-7a51-46f7-804e-ed1f4371645d}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@@ -96,6 +96,16 @@ BreakBeforeBinaryOperators: NonAssignment
# Allman(总是在大括号前换行), GNU(总是在大括号前换行,并对于控制语句的大括号增加额外的缩进), WebKit(在函数前换行), Custom
# 注:这里认为语句块也属于函数
BreakBeforeBraces: Custom
BraceWrapping:
AfterEnum: false
AfterStruct: false
AfterUnion: false
AfterCaseLabel: false
AfterClass: true
AfterFunction: true
SplitEmptyFunction: false
AfterNamespace: false
AfterExternBlock: false
# 在三元运算符前换行
BreakBeforeTernaryOperators: false
@@ -133,7 +143,8 @@ FixNamespaceComments: true
# 缩进case标签
IndentCaseLabels: false
IndentPPDirectives: None
# Possible values: None\AfterHash\BeforeHash
IndentPPDirectives: AfterHash
# 缩进宽度
IndentWidth: 4
@@ -219,7 +230,7 @@ IndentCaseLabels: true
#三元运算符将放置在换行符之后
BreakBeforeTernaryOperators: true
BreakBeforeBraces: Attach
BreakBeforeBraces: Custom
AllowShortCaseLabelsOnASingleLine: false
@@ -230,6 +241,9 @@ AlignTrailingComments: true
AlignOperands: AlignAfterOperator
#对齐宏
# They can also be read as a whole for compatibility.
# The choices are:
# - None - Consecutive - AcrossEmptyLines - AcrossComments - AcrossEmptyLinesAndComments
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
#对齐连续等号
AlignConsecutiveAssignments: AcrossEmptyLines

View File

@@ -0,0 +1,29 @@
#ifndef INC_FORMAT_H
#define INC_FORMAT_H
/*********************************************************************************
* INCLUDES
* *******************************************************************************/
/*********************************************************************************
* DEFINES
* *******************************************************************************/
#ifdef __INC_FORMAT_C__
# define DEF_EXTERN
#else
# define DEF_EXTERN extern
#endif
/*********************************************************************************
* MACROS
* *******************************************************************************/
/*********************************************************************************
* TYPEDEFS
* *******************************************************************************/
/*********************************************************************************
* GLOBAL PROTOTYPES
* *******************************************************************************/
#endif /* INC_FORMAT_H */

View File

@@ -0,0 +1,24 @@
/*********************************************************************************
* INCLUDES
* *******************************************************************************/
/*********************************************************************************
* DEFINES
* *******************************************************************************/
/*********************************************************************************
* MACROS
* *******************************************************************************/
/*********************************************************************************
* TYPEDEFS
* *******************************************************************************/
/*********************************************************************************
* STATIC FUNCTION
* *******************************************************************************/
/*********************************************************************************
* GLOBAL FUNCTION
* *******************************************************************************/

View File

@@ -29,14 +29,37 @@
/*********************************************************************************
* STATIC FUNCTION
* *******************************************************************************/
static void log_write_timer_cb(lv_timer_t *t)
{
LV_UNUSED(t);
TRACE_V("Hello wrold!");
TRACE_D("Hello wrold!");
TRACE_I("Hello wrold!");
TRACE_E("Hello wrold!");
TRACE_W("Hello wrold!");
Lib_TraceProc();
}
static bool log_write_to_file(LIB_TRACE_ITEM_HANDLE_T *item)
{
TRACE_D("item info = %s", item->Buf);
return true;
}
/*********************************************************************************
* GLOBAL FUNCTION
* *******************************************************************************/
void lvgl_app_init(void) {
void lvgl_app_init(void)
{
Lib_TraceInit();
Lib_TraceRegistWriter(log_write_to_file);
DataModelInit();
ScrMgrInit();
ScrMgrSwitchScr(GUI_MIAN_SCR_ID, true);
lv_timer_create(log_write_timer_cb, 3000, NULL);
}

View File

@@ -2,20 +2,11 @@
* FilePath : lvgl_app.h
* Author : GX.Duan
* Date : 2022-08-07 15:20:41
* LastEditTime : 2022-09-10 15:58:18
* LastEditTime : 2022-09-21 22:03:59
* LastEditors : ShallowGreen123 2608653986@qq.com
* Copyright (c): 2022 by GX.Duan, All Rights Reserved.
* Github : https://github.com/ShallowGreen123/lvgl_mydemo
************************************************************************/
/************************************************************************
* FilePath : lvgl_app.h
* Author : GX.Duan
* Date : 2022-08-07
* LastEditTime : 2022-08-19
* LastEditors : ShallowGreen123 2608653986@qq.com
* Copyright (c): by GX.Duan, All Rights Reserved.
* Github : https://github.com/ShallowGreen123/lvgl_mydemo
************************************************************************/
#ifndef LV_DEMO_INIT_H
#define LV_DEMO_INIT_H
@@ -24,6 +15,7 @@
* *******************************************************************************/
#include "../lvgl/lvgl.h"
#include <stdio.h>
#include "log/gui_log.h"
#include "data/dataModel.h"
#include "screen/gui_scr_mgr.h"

View File

@@ -1,3 +1,12 @@
/************************************************************************
* FilePath : gui_main_scr.c
* Author : GX.Duan
* Date : 2022-08-19 00:25:00
* LastEditTime : 2022-09-21 22:11:15
* LastEditors : ShallowGreen123 2608653986@qq.com
* Copyright (c): 2022 by GX.Duan, All Rights Reserved.
* Github : https://github.com/ShallowGreen123/lvgl_mydemo
************************************************************************/
/************************************************************************
* FilePath : gui_main_scr.c
* Author : GX.Duan
@@ -38,7 +47,7 @@ void swithc_btn_event_cb(lv_event_t *e) {
lv_obj_t *obj = lv_event_get_target(e);
if (obj == switch_btn) {
printf("Screen 1 switch_btn is pressed!\n");
TRACE_I("Screen 1 switch_btn is pressed!");
ScrMgrPushScr(GUI_TEST1_SCR_ID, true);
}
}

View File

@@ -1,3 +1,12 @@
/************************************************************************
* FilePath : gui_test1_scr.c
* Author : GX.Duan
* Date : 2022-09-10 17:10:59
* LastEditTime : 2022-09-21 22:46:10
* LastEditors : ShallowGreen123 2608653986@qq.com
* Copyright (c): 2022 by GX.Duan, All Rights Reserved.
* Github : https://github.com/ShallowGreen123/lvgl_mydemo
************************************************************************/
/************************************************************************
* FilePath : gui_test1_scr.c
* Author : GX.Duan
@@ -39,7 +48,7 @@ void test1_btn_event_cb(lv_event_t *e) {
lv_obj_t *obj = lv_event_get_target(e);
if (obj == test1_btn) {
printf("Screen 2 test1_btn is pressed!\n");
TRACE_I("Screen 2 test1_btn is pressed!");
ScrMgrPopScr(true);
}
}