Updated the .gitignore file, started to organize the project source files, created a new task to handle the graphics and more

This commit is contained in:
anschrammh 2022-11-29 21:24:51 +01:00
parent 1db0953b31
commit fc3850b6f3
19 changed files with 4235 additions and 13 deletions

4
.gitignore vendored
View File

@ -1,4 +1,6 @@
#Exclude the bin folder from the project
#Exclude the W800 SDK bin folder from the project
src/W800 SDK v1.00.08/bin/
#Exclude the lvgl simulator bin and obj folders from the project
src/lvgl_win_sim/lv_port_win_codeblocks/bin
src/lvgl_win_sim/lv_port_win_codeblocks/obj

View File

@ -3,6 +3,7 @@ sinclude $(TOP_DIR)/tools/w800/conf.mk
ifndef PDIR
GEN_LIBS = libuser$(LIB_EXT)
COMPONENTS_libuser = gfx/libusergfx$(LIB_EXT)
endif
#DEFINES +=

View File

@ -1,6 +1,8 @@
#ifndef APP_COMMON_H
#define APP_COMMON_H
#include "app_log.h"
#define NEW_LINE "\r\n"
#endif //APP_COMMON_H

View File

@ -0,0 +1,16 @@
TOP_DIR = ../..
sinclude $(TOP_DIR)/tools/w800/conf.mk
ifndef PDIR
GEN_LIBS = libusergfx$(LIB_EXT)
COMPONENTS_libusergfx = assets/libusergfxassets$(LIB_EXT)
endif
#DEFINES +=
sinclude $(TOP_DIR)/tools/w800/rules.mk
INCLUDES := $(INCLUDES) -I $(PDIR)include
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile

View File

@ -0,0 +1,15 @@
TOP_DIR = ../../..
sinclude $(TOP_DIR)/tools/w800/conf.mk
ifndef PDIR
GEN_LIBS = libusergfxassets$(LIB_EXT)
endif
#DEFINES +=
sinclude $(TOP_DIR)/tools/w800/rules.mk
INCLUDES := $(INCLUDES) -I $(PDIR)include
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
#include "app_common.h"
#include "lvgl.h"
#include "FreeRTOS.h"
#include "wm_include.h"
void gfx_task(void *param)
{
TickType_t time_ref = tls_os_get_time();
APP_LOG_TRACE("starting");
/* Initialize the lvgl library*/
lv_init();
/* Create, initialize and register the display driver*/
static lv_disp_drv_t display_driver;
lv_disp_drv_init(&display_driver);
for(;;)
{
lv_timer_handler();
tls_os_time_delay_until(&time_ref, pdMS_TO_TICKS(5));
}
}

View File

@ -0,0 +1,18 @@
#ifndef GFX_TASK_H
#define GFX_TASK_H
#include "FreeRTOS.h"
#include "wm_include.h"
#define GFX_STACK_SIZE_IN_BYTES (1024 * sizeof(StackType_t))
#define GFX_STACK_PRIORITY (31)
static u8 gfx_task_stack[GFX_STACK_SIZE_IN_BYTES];
tls_os_task_t gfx_task_handle;
/**
* @brief gfx_task is responsible for the UI (rendering graphics to the screen, handling UI related events)
*/
void gfx_task(void *param);
#endif //GFX_TASK_H

View File

@ -14,16 +14,37 @@
#include "wm_include.h"
#include "FreeRTOS.h"
#include "task.h"
#include "app_log.h"
#include "app_common.h"
#include "lvgl.h"
#include "gfx_task.h"
void user_main(void *param)
void user_task_main(void *param)
{
/* Creating the gfx task */
if(tls_os_task_create(&gfx_task_handle,"gfx_task",&(gfx_task), NULL, gfx_task_stack, GFX_STACK_SIZE_IN_BYTES, GFX_STACK_PRIORITY, 0 /*not used anyway*/) != TLS_OS_SUCCESS)
{
APP_LOG_ERROR("Failed to create GFX_TASK !");
}
uint32_t total_mem_size = (unsigned int)&__heap_end - (unsigned int)&__heap_start;
lv_init();
TickType_t time_ref = tls_os_get_time();
for(;;)
{
lv_timer_handler();
tls_os_time_delay(pdMS_TO_TICKS(5000));
char *buf = tls_mem_alloc(800);
if(buf)
{
UBaseType_t writtenSize = vTaskList((char *)buf, 800);
APP_LOG_INFO("Available RAM (bytes)/Total RAM (bytes) : %u/%u"NEW_LINE"Reset reason : %d"NEW_LINE"Tasks (%lu) :"NEW_LINE,
tls_mem_get_avail_heapsize(),
total_mem_size,
tls_sys_get_reboot_reason(),
writtenSize);
printf("\n%s", buf);
tls_mem_free(buf);
}
tls_os_time_delay_until(&time_ref, pdMS_TO_TICKS(5000));
}
}

View File

@ -772,6 +772,8 @@ tls_os_status_t tls_os_queue_flush(tls_os_queue_t *queue);
*/
void tls_os_time_delay(u32 ticks);
void tls_os_time_delay_until(u32 * const previous_wake_time, const u32 duration_in_ticks);
u8 tls_os_timer_active(tls_os_timer_t *timer);
u32 tls_os_timer_expirytime(tls_os_timer_t *timer);

View File

@ -3,7 +3,8 @@ sinclude $(TOP_DIR)/tools/w800/conf.mk
ifndef PDIR
GEN_LIBS = liblvgl$(LIB_EXT)
COMPONENTS_liblvgl = lvgl_v8.3/liblvglv8_3$(LIB_EXT)
COMPONENTS_liblvgl = lvgl_v8.3/liblvglv8_3$(LIB_EXT) \
lvgl_port/liblvgl_port$(LIB_EXT)
endif
#DEFINES +=

View File

@ -0,0 +1,15 @@
TOP_DIR = ../..
sinclude $(TOP_DIR)/tools/w800/conf.mk
ifndef PDIR
GEN_LIBS = liblvgl_port$(LIB_EXT)
endif
#DEFINES +=
sinclude $(TOP_DIR)/tools/w800/rules.mk
INCLUDES := $(INCLUDES) -I $(PDIR)include
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile

View File

@ -0,0 +1,8 @@
#include "FreeRTOS.h"
#include "lvgl.h"
void vApplicationTickHook(void)
{
/* One tick is 2 ms because configTICK_RATE_HZ = 500. */
lv_tick_inc(2);
}

View File

@ -124,7 +124,7 @@ extern u8 tx_gain_group[];
extern void *tls_wl_init(u8 *tx_gain, u8 *mac_addr, u8 *hwver);
extern int wpa_supplicant_init(u8 *mac_addr);
extern void tls_sys_auto_mode_run(void);
extern void user_main(void*);
extern void user_task_main(void*);
extern void tls_bt_entry();
#if (TLS_CONFIG_HOSTIF&&TLS_CONFIG_UART)
extern int tls_uart_get_at_cmd_port(void);
@ -451,7 +451,7 @@ void task_start (void *data)
tls_os_task_create(
&tstusermainhdl,
"usrmain",
&(user_main),
&(user_task_main),
NULL,
(void*) TaskUsermainStk,
TASK_USERMAIN_STK_SIZE * sizeof(u32),

View File

@ -70,7 +70,7 @@
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1 //ʹ<>ÿ<EFBFBD><C3BF>й<EFBFBD><D0B9><EFBFBD>
#define configUSE_TICK_HOOK 0
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( ( unsigned long ) 40000000 ) /* =12.0MHz xtal multiplied by 5 using the PLL. *///???????????????

View File

@ -4564,7 +4564,7 @@ static void prvResetNextTaskUnblockTime( void )
/* Make sure the write buffer does not contain a string. */
strncpy(pcWriteBuffer,"task\t\ttask num\ttask prio\ttask status\tstack total\tstack remain\tstack least remain\tmin stack space\r\n", uxWriteBufferSize);
strncpy(pcWriteBuffer,"task\t\ttask num\ttask prio\ttask status\tstack total\tstack remain\tstack least remain (Bytes)\tmin stack space (Words)\r\n", uxWriteBufferSize);
pcWriteBuffer[uxWriteBufferSize] = '\0';
UBaseType_t writtenSize = strlen(pcWriteBuffer);
/* We move the string pointer n bytes to be ready to write the next data. */
@ -4652,7 +4652,7 @@ static void prvResetNextTaskUnblockTime( void )
uxWriteBufferSize -= writtenSize;
/* Write the rest of the string. */
writtenSize = snprintf(pcWriteBuffer, uxWriteBufferSize, "\t\t%lu\t\t%u\t\t%c\t\t%u\t\t%u\t\t%u\t\t%u\t\r\n",
writtenSize = snprintf(pcWriteBuffer, uxWriteBufferSize, "\t\t%lu\t\t%u\t\t%c\t\t%u\t\t%u\t\t\t%u\t\t\t\t%u\t\r\n",
pxTaskStatusArray[ x ].xTaskNumber,
( unsigned int ) (configMAX_PRIORITIES - pxTaskStatusArray[ x ].uxCurrentPriority),
cStatus,

View File

@ -1414,11 +1414,16 @@ u32 tls_os_timer_expirytime(tls_os_timer_t *timer)
* Returns : none
*********************************************************************************************************
*/
void tls_os_time_delay(u32 ticks)
void tls_os_time_delay(u32 ticks)
{
vTaskDelay(ticks);
}
void tls_os_time_delay_until(u32 * const previous_wake_time, const u32 duration_in_ticks)
{
vTaskDelayUntil(previous_wake_time, duration_in_ticks);
}
/*
*********************************************************************************************************
* task stat info

View File

@ -44,6 +44,7 @@ INCLUDES += -I $(TOP_DIR)/src/os/rtos/include
INCLUDES += -I $(TOP_DIR)/src/app/factorycmd
INCLUDES += -I $(TOP_DIR)/src/app/bleapp
INCLUDES += -I $(TOP_DIR)/app/app_include
INCLUDES += -I $(TOP_DIR)/app/gfx
INCLUDES += -I $(TOP_DIR)/app
#lvgl include