This commit is contained in:
JiXieShi
2024-09-21 16:07:31 +08:00
parent 4e53f936d8
commit d2e5789476
27 changed files with 129 additions and 67 deletions

View File

@@ -5,6 +5,6 @@
#ifndef HW_LIB_T_ARG_H
#define HW_LIB_T_ARG_H
void Test_argpase();
void Test_argpase(void *pVoid);
#endif //HW_LIB_T_ARG_H

View File

@@ -11,7 +11,7 @@ Option Opts[6] = {{"T0", T0},
{"T4", T4},
{"T5", T5}};
void Test_argpase() {
void Test_argpase(void *pVoid) {
OptList *Head = Options_Creat("Head", -1);
OptList *t;
int i;
@@ -46,4 +46,4 @@ void Test_argpase() {
break;
}
}
}
}

View File

@@ -5,6 +5,6 @@
#ifndef HW_LIB_T_IIC_H
#define HW_LIB_T_IIC_H
void Test_iic();
void Test_iic(void *pVoid);
#endif //HW_LIB_T_IIC_H

View File

@@ -28,7 +28,7 @@ uint8_t SDA_Read() {
return l;
}
void Test_iic() {
void Test_iic(void *pVoid) {
SW_Dev_IIC dev = {
.CLK_SET = CLK_Pin,
.SDA_SET = SDA_Set,
@@ -57,4 +57,4 @@ void Test_iic() {
SW_IIC_WL(dev, internalAddress, writeData, len);
SW_IIC_RL(dev, internalAddress, readData, len, 1);
BufPrint("<IIC> RX", readData, TYPE_T(readData), len, 16);
}
}

View File

@@ -1,6 +1,6 @@
#ifndef HW_LIB_T_KEY_H
#define HW_LIB_T_KEY_H
void Test_Key();
void Test_Key(void *pVoid);
#endif //HW_LIB_T_KEY_H

View File

@@ -38,7 +38,7 @@ void Key_Call(Key_t *key) {
}
}
void Test_Key() {
void Test_Key(void *pVoid) {
Key_t k1, k2, k3, k4, k5, k6, ks;
key_init(&k1, SIM_KEY_UP, 1, SIM_Key_UP);
key_init(&k2, SIM_KEY_DOWN, 1, SIM_Key_DOWN);
@@ -61,4 +61,4 @@ void Test_Key() {
key_ticks();
Sleep(5);
}
}
}

View File

@@ -5,7 +5,7 @@
#ifndef HW_LIB_T_LIST_H
#define HW_LIB_T_LIST_H
extern void Test_List();
extern void Test_List(void *pVoid);
extern void Test_Queue();
extern void Test_Queue(void *pVoid1);
#endif //HW_LIB_T_LIST_H

View File

@@ -38,7 +38,7 @@ void print(List_t *list) {
}
}
void Test_List() {
void Test_List(void *pVoid) {
List_t list;
list_init(&list); // 初始化链表
@@ -102,7 +102,7 @@ void Test_List() {
list_destroy(&list, NULL); // 销毁链表
}
void Test_Queue() {
void Test_Queue(void *pVoid) {
Queue_List_t *deque = newQueue_List(sizeof(int)); // 创建一个int类型的双端队列
// 测试入队操作
@@ -141,4 +141,4 @@ void Test_Queue() {
printf("Pop value from front: %d\n", *popVal);
}
delQueue_List(deque);
}
}

View File

@@ -5,6 +5,6 @@
#ifndef HW_LIB_T_LVGL_H
#define HW_LIB_T_LVGL_H
void Test_lvgl();
void Test_lvgl(void *pVoid);
#endif //HW_LIB_T_LVGL_H

View File

@@ -6,17 +6,42 @@
#include <windows.h>
#include "t_lvgl.h"
void Test_lvgl() {
static void btn_event_cb(lv_event_t *e) {
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *btn = lv_event_get_target(e);
if (code == LV_EVENT_CLICKED) {
static uint8_t cnt = 0;
cnt++;
/*Get the first child of the button which is the label and change its text*/
lv_obj_t *label = lv_obj_get_child(btn, 0);
lv_label_set_text_fmt(label, "Button: %d", cnt);
}
}
/**
* Create a button with a label and react on click event.
*/
void lv_example_get_started_1(void) {
lv_obj_t *btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_add_event_cb(btn, btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/
lv_obj_t *label = lv_label_create(btn); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
lv_obj_center(label);
}
void Test_lvgl(void *pVoid) {
lv_init();
lv_port_disp_init();
lv_port_indev_init();
// lv_obj_t * bar1 = lv_bar_create(lv_scr_act());
// lv_obj_set_size(bar1, 200, 20);
// lv_obj_center(bar1);
// lv_bar_set_value(bar1, 70, LV_ANIM_OFF);
lv_example_get_started_1();
// lv_demo_widgets();
// printf("\nTEST Widgets\n");
printf("\nTEST Widgets\n");
while (1) {
/* Periodically call the lv_task handler.

View File

@@ -1,6 +1,6 @@
#ifndef HW_LIB_T_OLED_H
#define HW_LIB_T_OLED_H
void Test_OLED();
void Test_OLED(void *pVoid);
#endif //HW_LIB_T_OLED_H

View File

@@ -111,7 +111,7 @@ OLED_T oled = {
.call=Refresh_Call,
};
void Test_OLED() {
void Test_OLED(void *pVoid) {
SIM_OLED_INIT(128, 64, CYAN, 0x0, 5, 0);
SIM_OLED_START();
@@ -145,4 +145,4 @@ void Test_OLED() {
Sleep(200);
}
SIM_OLED_STOP();
}
}

View File

@@ -4,5 +4,6 @@
#ifndef HW_LIB_T_SPI_H
#define HW_LIB_T_SPI_H
void Test_spi();
void Test_spi(void *pVoid);
#endif //HW_LIB_T_SPI_H

View File

@@ -32,7 +32,7 @@ uint8_t Miso_Pin() {
return l;
}
void Test_spi() {
void Test_spi(void *pVoid) {
SW_Dev_Spi ltl = {
.MOSI_SET=Mosi_Pin,
.SCK_SET=Sck_Pin,
@@ -59,4 +59,4 @@ void Test_spi() {
SW_SPI_RWL16(ltl, rbuf16, tbuf16, 64);
BufPrint("<SPI> TX[16]", tbuf16, TYPE_T(tbuf16), 64, 16);
BufPrint("<SPI> RX[16]", rbuf16, TYPE_T(rbuf16), 64, 16);
}
}

View File

@@ -5,6 +5,6 @@
#ifndef HW_LIB_T_TASK_H
#define HW_LIB_T_TASK_H
_Noreturn void Test_task();
_Noreturn void Test_task(void *pVoid);
#endif //HW_LIB_T_TASK_H

View File

@@ -40,7 +40,7 @@ void exampleTimer4Callback(Task_t *task, void *userData) {
}
}
void Test_task() {
void Test_task(void *pVoid) {
TaskInit(GetTick);
TaskCreat(task1, 1000, -1, exampleTimer1Callback, "1000ms CYCLE task");
TaskCreat(task2, 5000, -1, exampleTimer2Callback, "5000ms ONCE task");
@@ -53,4 +53,4 @@ void Test_task() {
while (1) {
TaskRun();
}
}
}

View File

@@ -1,6 +1,6 @@
#ifndef HW_LIB_T_TFT_H
#define HW_LIB_T_TFT_H
void Test_tft();
void Test_tft(void *);
#endif //HW_LIB_T_TFT_H

View File

@@ -103,7 +103,7 @@ uint8_t tft_senddata(uint8_t *data, size_t len) {
return result;
}
void Test_tft() {
void Test_tft(void *) {
//设备信息预填充
demo_tft.width = 480;//实际如有支持不用填(如ST7735/7796)