Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into control_framework

This commit is contained in:
Liu_Weichao
2023-04-26 10:50:45 +08:00
227 changed files with 565594 additions and 1529 deletions

View File

@@ -13,6 +13,7 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
SRC_FILES := main.c
ifeq ($(CONFIG_LIB_LV),y)
SRC_DIR += lv_app
SRC_DIR += tinyttf_app
endif
ifeq ($(CONFIG_APPLICATION_OTA),y)

View File

@@ -235,6 +235,10 @@ menu "test app"
default "/dev/qspi_W25Q128"
endif
endif
menuconfig USER_TEST_TIMER
bool "Config test soft timer"
default n
endif
endmenu

View File

@@ -97,5 +97,9 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
SRC_FILES += test_can.c
endif
ifeq ($(CONFIG_USER_TEST_TIMER),y)
SRC_FILES += test_timer.c
endif
include $(KERNEL_ROOT)/compiler.mk
endif

View File

@@ -18,6 +18,7 @@
* @date: 2022/1/7
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -56,4 +57,5 @@ void TestAdc(void)
return;
}
PRIV_SHELL_CMD_FUNCTION(TestAdc, a adc test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestAdc, a adc test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,8 +1,29 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_camera.c
* @brief: a application of camera function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/7
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
static uint16_t image_buff[384000];
void TestCamera(int argc, char *argv[])
@@ -96,4 +117,5 @@ void TestCamera(int argc, char *argv[])
printf("The camera test is finished successfully\n");
}
PRIV_SHELL_CMD_FUNCTION(TestCamera, a camera test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestCamera, a camera test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_can.c
* @brief: a application of can function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2023/2/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -64,3 +84,4 @@ void TestCAN(void)
}
PRIV_SHELL_CMD_FUNCTION(TestCAN, a can test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -17,7 +17,7 @@
* @author: AIIT XUOS Lab
* @date: 2022/1/11
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -57,3 +57,4 @@ void TestDac(void)
return;
}
PRIV_SHELL_CMD_FUNCTION(TestDac, a dac test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_ethernet.c
* @brief: a application of ethernet function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -171,3 +191,4 @@ PRIV_SHELL_CMD_FUNCTION(TestSocketAsClient, a w5500 client-ip-port-msg test samp
#endif
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_flash.c
* @brief: a application of flash function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -32,4 +52,5 @@ void TestFlash(void)
return;
}
PRIV_SHELL_CMD_FUNCTION(TestFlash, a flash test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestFlash, a flash test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_fs.c
* @brief: a application of file_system function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/11/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -59,4 +79,5 @@ void TestFs(void)
return;
}
PRIV_SHELL_CMD_FUNCTION(TestFs, a sd or usb filesystem test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestFs, a sd or usb filesystem test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_gpio.c
* @brief: a application of GPIO function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -70,4 +90,5 @@ void TestGpio(void)
}
}
PRIV_SHELL_CMD_FUNCTION(TestGpio, a gpio test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestGpio, a gpio test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_hwtimer.c
* @brief: a application of hwtimer function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -73,4 +93,5 @@ void TestHwTimer(void)
PrivClose(timer_fd);
}
PRIV_SHELL_CMD_FUNCTION(TestHwTimer, a timer test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestHwTimer, a timer test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_i2c.c
* @brief: a application of i2c function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -48,3 +68,4 @@ void TestI2C(void)
}
PRIV_SHELL_CMD_FUNCTION(TestI2C, a iic test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_lcd.c
* @brief: a application of lcd function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -18,8 +38,21 @@ void TestLcd(void)
return;
}
// draw text
LcdWriteParam graph_param;
// black
uint16* color_select = malloc(sizeof(uint16) * 321 * 321);
memset(color_select, 0x00, sizeof(uint16) * 321 * 321);
graph_param.type = LCD_DOT_TYPE;
graph_param.pixel_info.x_startpos = 0;
graph_param.pixel_info.y_startpos = 0;
graph_param.pixel_info.x_endpos = 320;
graph_param.pixel_info.y_endpos = 320;
graph_param.pixel_info.pixel_color = color_select;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
free(color_select);
// draw text
graph_param.type = LCD_STRING_TYPE;
graph_param.string_info.x_pos = 0;
graph_param.string_info.y_pos = 0;
@@ -29,22 +62,28 @@ void TestLcd(void)
graph_param.string_info.back_color = 0xFFFF;
graph_param.string_info.font_color = 0x0000;
graph_param.string_info.addr = "hello_world!";
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
uint16 color_select = 0xF800;
for (int i = 0; i < 5; i++)
// draw line
color_select = malloc(sizeof(uint16) * 1 * 320);
for (int i = 0; i < 320; i++)
{
color_select[i] = 0xF800;
}
for (int i = 1; i <= 5; i++)
{
graph_param.type = LCD_DOT_TYPE;
graph_param.pixel_info.x_startpos = 0;
graph_param.pixel_info.y_startpos = 50 * i;
graph_param.pixel_info.x_endpos = 320;
graph_param.pixel_info.y_endpos = 50 * i;
graph_param.pixel_info.pixel_color = &color_select;
graph_param.pixel_info.y_startpos = i * 50;
graph_param.pixel_info.x_endpos = 319;
graph_param.pixel_info.y_endpos = i * 50;
graph_param.pixel_info.pixel_color = color_select;
PrivWrite(lcd_fd, &graph_param, NULL_PARAMETER);
}
free(color_select);
PrivClose(lcd_fd);
}
PRIV_SHELL_CMD_FUNCTION(TestLcd, a lcd test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestLcd, a lcd test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_loraE220.c
* @brief: a application of loraE220 function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -145,3 +165,4 @@ void TestLora(int argc, char *argv[])
}
PRIV_SHELL_CMD_FUNCTION(TestLora, a lora test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_rs485.c
* @brief: a application of rs485 function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -83,4 +103,5 @@ void Test485(void)
return;
}
PRIV_SHELL_CMD_FUNCTION(Test485, a RS485 test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(Test485, a RS485 test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_rtc.c
* @brief: a application of rtc function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -39,3 +59,4 @@ void TestRTC(int argc,char *argv[])
}
PRIV_SHELL_CMD_FUNCTION(TestRTC, a rtc test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_timer.c
* @brief: a application of soft timer function
* @version: 3.0
* @author: AIIT XUOS Lab
* @date: 2023/03/09
*/
#include <transform.h>
void TimerFunction(union sigval sig_val)
{
static int cnt = 0;
printf("%s cnt %d\n", __func__, cnt++);
}
void TestTimer(void)
{
int ret = 0;
int timer_flags;
timer_t timer_id;
struct sigevent evp;
memset(&evp, 0, sizeof(struct sigevent));
timer_flags = TIMER_TRIGGER_PERIODIC;
evp.sigev_notify = SIGEV_THREAD;
evp.sigev_notify_function = TimerFunction;
evp.sigev_notify_attributes = &timer_flags;
ret = timer_create(CLOCK_REALTIME, &evp, &timer_id);
if (ret < 0) {
printf("%s create timer failed ret %d\n", __func__, ret);
return;
}
struct itimerspec value;
//active time interval
value.it_interval.tv_sec = 2;
value.it_interval.tv_nsec = 0;
//first timer set time
value.it_value.tv_sec = 2;
value.it_value.tv_nsec = 0;
ret = timer_settime(timer_id, 1, &value, NULL);
if (ret < 0) {
printf("%s set timer time failed ret %d\n", __func__, ret);
return;
}
printf("%s success\n", __func__);
}
PRIV_SHELL_CMD_FUNCTION(TestTimer, soft timer test, PRIV_SHELL_CMD_MAIN_ATTR);

View File

@@ -40,7 +40,6 @@ void TestTouch(void)
}
#endif
#endif
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -49,6 +48,7 @@ void TestTouch(void)
#define LCD_DOT_TYPE 1
#define LCD_SIZE 320
#elif ADD_XIZI_FETURES
void TestTouch(void)
{
@@ -109,4 +109,5 @@ void TestTouch(void)
PrivClose(touch_fd);
}
PRIV_SHELL_CMD_FUNCTION(TestTouch, a touch test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestTouch, a touch test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -1,3 +1,23 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: test_wdt.c
* @brief: a application of wdt function
* @version: 1.1
* @author: AIIT XUOS Lab
* @date: 2022/12/17
*/
#ifdef ADD_XIZI_FETURES
#include <stdio.h>
#include <string.h>
#include <transform.h>
@@ -42,4 +62,5 @@ void TestWDT(int argc, char *agrv[])
return;
}
PRIV_SHELL_CMD_FUNCTION(TestWDT, a wdt test sample, PRIV_SHELL_CMD_MAIN_ATTR);
PRIV_SHELL_CMD_FUNCTION(TestWDT, a wdt test sample, PRIV_SHELL_CMD_MAIN_ATTR);
#endif

View File

@@ -142,8 +142,8 @@ void UdpSocketRecvTest(int argc, char *argv[])
#endif
#ifdef ADD_NUTTX_FETURES
pthread_attr_t attr = PTHREAD_ATTR_INITIALIZER;
attr.priority = LWIP_TCP_DEMO_TASK_PRIO;
attr.stacksize = LWIP_TCP_DEMO_TASK_STACK_SIZE;
attr.priority = LWIP_UDP_DEMO_TASK_PRIO;
attr.stacksize = LWIP_UDP_DEMO_TASK_STACK_SIZE;
#endif
PrivTaskCreate(&udp_server_task, &attr, &UdpSocketRecvTask, NULL);
@@ -208,8 +208,8 @@ void UdpSocketSendTest(int argc, char *argv[])
#endif
#ifdef ADD_NUTTX_FETURES
pthread_attr_t attr = PTHREAD_ATTR_INITIALIZER;
attr.priority = LWIP_TCP_DEMO_TASK_PRIO;
attr.stacksize = LWIP_TCP_DEMO_TASK_STACK_SIZE;
attr.priority = LWIP_UDP_DEMO_TASK_PRIO;
attr.stacksize = LWIP_UDP_DEMO_TASK_STACK_SIZE;
#endif
PrivTaskCreate(&udp_client_task, &attr, &UdpSocketSendTask, NULL);

View File

@@ -158,7 +158,7 @@ int CircularAreaAppRead(CircularAreaAppType circular_area, uint8_t *output_buffe
{
CA_PARAM_CHECK(circular_area);
CA_PARAM_CHECK(output_buffer);
CHECK(data_length > 0);
CA_CHECK(data_length > 0);
if(CircularAreaAppIsEmpty(circular_area)) {
return -1;
@@ -199,7 +199,7 @@ int CircularAreaAppWrite(CircularAreaAppType circular_area, uint8_t *input_buffe
{
CA_PARAM_CHECK(circular_area);
CA_PARAM_CHECK(input_buffer);
CHECK(data_length > 0);
CA_CHECK(data_length > 0);
if(CircularAreaAppIsFull(circular_area) && (!b_force)) {
return -1;
@@ -248,7 +248,7 @@ static struct CircularAreaAppOps CircularAreaAppOperations =
*/
CircularAreaAppType CircularAreaAppInit(uint32_t circular_area_length)
{
CHECK(circular_area_length > 0);
CA_CHECK(circular_area_length > 0);
circular_area_length = CA_ALIGN_DOWN(circular_area_length, 8);

View File

@@ -29,11 +29,20 @@
extern "C" {
#endif
#define CA_CHECK(TRUE_CONDITION) \
do \
{ \
if(!(TRUE_CONDITION)) { \
printf("%s CHECK condition is false at line[%d] of [%s] func.\n", #TRUE_CONDITION, __LINE__, __func__);\
while(1); \
} \
}while (0)
#define CA_PARAM_CHECK(param) \
do \
{ \
if(param == NULL) { \
KPrintf("PARAM CHECK FAILED ...%s %d %s is NULL.\n", __func__, __LINE__, #param); \
printf("PARAM CHECK FAILED ...%s %d %s is NULL.\n", __func__, __LINE__, #param); \
while(1); \
} \
}while (0)

View File

@@ -0,0 +1,3 @@
# ISSUE
Code in Lib `tjpgd` might be redefined in RT-thread(which has not been tested). if occurs, please try to temporarily delete `tjpgd.c` in dir and `tjpgd.h` in ../model/m4/.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
/*----------------------------------------------------------------------------/
/ TJpgDec - Tiny JPEG Decompressor include file (C)ChaN, 2019
/----------------------------------------------------------------------------*/
#ifndef DEF_TJPGDEC
#define DEF_TJPGDEC
/*---------------------------------------------------------------------------*/
/* System Configurations */
#define JD_SZBUF 512 /* Size of stream input buffer */
#define JD_FORMAT 1 /* Output pixel format 0:RGB888 (3 BYTE/pix), 1:RGB565 (1 WORD/pix) */
#define JD_USE_SCALE 1 /* Use descaling feature for output */
#define JD_TBLCLIP 1 /* Use table for saturation (might be a bit faster but increases 1K bytes of code size) */
#define JD_SCALE 2 /* 0:1/1 1:1/2 2:1/4 3:1/8 */
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32) /* Main development platform */
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef short int16_t;
typedef unsigned long uint32_t;
typedef long int32_t;
#else
#include "stdint.h"
#endif
/* Error code */
typedef enum
{
JDR_OK = 0, /* 0: Succeeded */
JDR_INTR, /* 1: Interrupted by output function */
JDR_INP, /* 2: Device error or wrong termination of input stream */
JDR_MEM1, /* 3: Insufficient memory pool for the image */
JDR_MEM2, /* 4: Insufficient stream input buffer */
JDR_PAR, /* 5: Parameter error */
JDR_FMT1, /* 6: Data format error (may be damaged data) */
JDR_FMT2, /* 7: Right format but not supported */
JDR_FMT3 /* 8: Not supported JPEG standard */
} JRESULT;
/* Rectangular structure */
typedef struct
{
uint16_t left, right, top, bottom;
} JRECT;
/* Decompressor object structure */
typedef struct JDEC JDEC;
struct JDEC
{
uint16_t dctr; /* Number of bytes available in the input buffer */
uint8_t *dptr; /* Current data read ptr */
uint8_t *inbuf; /* Bit stream input buffer */
uint8_t dmsk; /* Current bit in the current read byte */
uint8_t scale; /* Output scaling ratio */
uint8_t msx, msy; /* MCU size in unit of block (width, height) */
uint8_t qtid[3]; /* Quantization table ID of each component */
int16_t dcv[3]; /* Previous DC element of each component */
uint16_t nrst; /* Restart inverval */
uint16_t width, height; /* Size of the input image (pixel) */
uint8_t *huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
uint16_t *huffcode[2][2]; /* Huffman code word tables [id][dcac] */
uint8_t *huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
int32_t *qttbl[4]; /* Dequantizer tables [id] */
void *workbuf; /* Working buffer for IDCT and RGB output */
uint8_t *mcubuf; /* Working buffer for the MCU */
void *pool; /* Pointer to available memory pool */
uint16_t sz_pool; /* Size of momory pool (bytes available) */
uint16_t (*infunc)(JDEC *, uint8_t *, uint16_t); /* Pointer to jpeg stream input function */
void *device; /* Pointer to I/O device identifiler for the session */
};
/* TJpgDec API functions */
JRESULT jd_prepare (JDEC *, uint16_t(*)(JDEC *, uint8_t *, uint16_t), void *, uint16_t, void *);
JRESULT jd_decomp (JDEC *, uint16_t(*)(JDEC *, void *, JRECT *), uint8_t);
#ifdef __cplusplus
}
#endif
#endif /* _TJPGDEC */

View File

@@ -0,0 +1,3 @@
SRC_FILES := ttf_demo.c lv_example_tiny_ttf_1.c lv_example_tiny_ttf_2.c
include $(KERNEL_ROOT)/compiler.mk

View File

@@ -0,0 +1,12 @@
## Tiny TTF font engine
用于在触摸屏上渲染矢量字体若要使用该引擎需开启LVGL。
### Usage
`lv_conf.h`中开启`LV_USE_TINY_TTF`,可以使用`lv_tiny_ttf_create_data(data, data_size, line_height)`创建字体创建字体后像LVGL正常字体一样使用。
默认情况下TTF或者OTF文件必须作为数组嵌入到程序`ubuntu_font`如果要从sd卡中读取文件需开启`LV_TINY_TTF_FILE_SUPPORT``LV_USE_FS_POSIX`
> 注意从sd卡中读取字库文件会比较慢请谨慎使用
默认情况下字体使用4KB缓存来加速渲染可以使用`lv_tiny_ttf_create_data_ex(data, data_size, line_height, cache_size)`或者`lv_tiny_ttf_create_file_ex(path, line_height, cache_size)`更改此大小
### API
见 xiuos/APP_Framework/lib/lvgl/src/extra/libs/tiny_ttf/lv_tiny_ttf.h

View File

@@ -0,0 +1,39 @@
/**
* @file lv_example_tiny_ttf.h
*
*/
#ifndef LV_EXAMPLE_TINY_TTF_H
#define LV_EXAMPLE_TINY_TTF_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_example_tiny_ttf_1(void);
void lv_example_tiny_ttf_2(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_TINY_TTF_H*/

View File

@@ -0,0 +1,25 @@
#include <../../lib/lvgl/examples/lv_examples.h>
#if LV_USE_TINY_TTF && LV_BUILD_EXAMPLES
#include "ubuntu_font_ch.h"
/**
* Load a font with Tiny_TTF
*/
void lv_example_tiny_ttf_1(void)
{
/*Create style with the new font*/
static lv_style_t style;
lv_style_init(&style);
lv_font_t * font = lv_tiny_ttf_create_data(ubuntu_font, sizeof(ubuntu_font), 35);
lv_style_set_text_font(&style, font);
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
/*Create a label with the new style*/
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_obj_add_style(label, &style, 0);
lv_label_set_text(label, "你好世界\nI'm a font\ncreated\nwith Tiny TTF");
lv_obj_center(label);
}
#endif

View File

@@ -0,0 +1,30 @@
#include <../../lib/lvgl/examples/lv_examples.h>
#if LV_USE_TINY_TTF && LV_TINY_TTF_FILE_SUPPORT //&& LV_BUILD_EXAMPLES
#define MAX_READ_LENGTH 1000
#include <stdio.h>
#include <string.h>
#include <transform.h>
/**
* Load a font with Tiny_TTF from file
*/
void lv_example_tiny_ttf_2(void)
{
/*Create style with the new font*/
static lv_style_t style;
lv_style_init(&style);
lv_font_t * font = lv_tiny_ttf_create_file("G:/normal.ttf", 35);
lv_style_set_text_font(&style, font);
lv_style_set_text_align(&style, LV_TEXT_ALIGN_CENTER);
/*Create a label with the new style*/
lv_obj_t * label = lv_label_create(lv_scr_act());
lv_obj_set_size(label, 240, 136);
lv_obj_add_style(label, &style, 0);
lv_label_set_text(label, "你好世界\nI'm a font\ncreated\nwith Tiny TTF");
lv_obj_center(label);
lv_tiny_ttf_destroy(font);
}
#endif

Binary file not shown.

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file: ttf_demo.c
* @brief: a application using tinyttf
* @version: 2.0
* @author: AIIT XUOS Lab
* @date: 2023/3/15
*
*/
#include <lvgl.h>
#include <lv_port_indev_template.h>
#include <transform.h>
extern void lv_example_tiny_ttf_1(void);
extern void lv_example_tiny_ttf_2(void);
void* ttf_thread(void *parameter)
{
/* display demo; you may replace with your LVGL application at here */
lv_example_tiny_ttf_1();
// lv_example_tiny_ttf_1();
/* handle the tasks of LVGL */
while(1)
{
lv_task_handler();
PrivTaskDelay(10);
}
}
pthread_t lvgl_task;
static int ttf_demo_init(void)
{
pthread_attr_t attr;
attr.schedparam.sched_priority = 25;
attr.stacksize = 4096;
PrivTaskCreate(&lvgl_task, &attr, ttf_thread, NULL);
return 0;
}
PRIV_SHELL_CMD_FUNCTION(ttf_demo_init, a tinyttf init sample, PRIV_SHELL_CMD_MAIN_ATTR);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff