增加底层CAN接口调用和软键盘支持
This commit is contained in:
parent
b3aa2929d5
commit
36377d17d6
@ -37,7 +37,7 @@ endif()
|
|||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|
||||||
set(SRC_LIST main.c dir_Socket.c lvgl_task.c lvgl_indev.c mouse_cursor_icon.c)
|
set(SRC_LIST main.c dir_Socket.c lvgl_task.c lvgl_indev.c mouse_cursor_icon.c Socket_can.c)
|
||||||
|
|
||||||
|
|
||||||
set(APP_Name Home_KitAPP)
|
set(APP_Name Home_KitAPP)
|
||||||
|
|||||||
@ -19,6 +19,11 @@
|
|||||||
#include "guider_customer_fonts.h"
|
#include "guider_customer_fonts.h"
|
||||||
#include "../custom/custom.h"
|
#include "../custom/custom.h"
|
||||||
#include "../custom/lv_conf_ext.h"
|
#include "../custom/lv_conf_ext.h"
|
||||||
|
#include "../../Socket_can.h"
|
||||||
|
|
||||||
|
// 全局变量,用于存储上一次点击的 textarea
|
||||||
|
static lv_obj_t *last_clicked_textarea = NULL;
|
||||||
|
|
||||||
void screen_home_init(lv_ui *ui)
|
void screen_home_init(lv_ui *ui)
|
||||||
{
|
{
|
||||||
#ifdef USE_CUSTOM_CODE
|
#ifdef USE_CUSTOM_CODE
|
||||||
@ -56,10 +61,23 @@ static void screen_home_ta_2_event_handler (lv_event_t *e)
|
|||||||
switch (code) {
|
switch (code) {
|
||||||
case LV_EVENT_CLICKED:
|
case LV_EVENT_CLICKED:
|
||||||
{
|
{
|
||||||
|
last_clicked_textarea = guider_ui.screen_home_ta_2;
|
||||||
|
lv_obj_clear_flag(guider_ui.screen_home_cont_1, LV_OBJ_FLAG_HIDDEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LV_EVENT_VALUE_CHANGED:
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void screen_home_ta_1_event_handler (lv_event_t *e)
|
||||||
|
{
|
||||||
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
switch (code) {
|
||||||
|
case LV_EVENT_CLICKED:
|
||||||
{
|
{
|
||||||
|
last_clicked_textarea = guider_ui.screen_home_ta_1;
|
||||||
|
lv_obj_clear_flag(guider_ui.screen_home_cont_1, LV_OBJ_FLAG_HIDDEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -81,6 +99,17 @@ static void screen_home_tabview_1_event_handler (lv_event_t *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定义按钮状态映射数组
|
||||||
|
static uint16_t btnm_state_map[] = {
|
||||||
|
0, // 按钮 0 的初始状态(0 表示正常状态)
|
||||||
|
0, // 按钮 1 的初始状态
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
static void screen_home_btnm_1_event_handler (lv_event_t *e)
|
static void screen_home_btnm_1_event_handler (lv_event_t *e)
|
||||||
{
|
{
|
||||||
lv_event_code_t code = lv_event_get_code(e);
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
@ -96,14 +125,25 @@ static void screen_home_btnm_1_event_handler (lv_event_t *e)
|
|||||||
lv_obj_clear_flag(guider_ui.screen_home_win_1, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(guider_ui.screen_home_win_1, LV_OBJ_FLAG_HIDDEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (1):
|
case (1)://打开CAN接口
|
||||||
{
|
{
|
||||||
lv_led_set_color(guider_ui.screen_home_led_1, lv_color_hex(0xff0000));
|
lv_led_set_color(guider_ui.screen_home_led_1, lv_color_hex(0x00ff55));
|
||||||
|
|
||||||
|
btnm_state_map[1] = LV_BTNMATRIX_CTRL_DISABLED;
|
||||||
|
btnm_state_map[2] = 0;
|
||||||
|
lv_btnmatrix_set_ctrl_map(obj, btnm_state_map);
|
||||||
|
|
||||||
|
sockfd_can0 = socket_can_init("can1");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (2):
|
case (2):
|
||||||
{
|
{
|
||||||
lv_led_set_color(guider_ui.screen_home_led_1, lv_color_hex(0x00ff55));
|
lv_led_set_color(guider_ui.screen_home_led_1, lv_color_hex(0xff0000));//0xff0000
|
||||||
|
|
||||||
|
btnm_state_map[2] = LV_BTNMATRIX_CTRL_DISABLED;
|
||||||
|
btnm_state_map[1] = 0;
|
||||||
|
lv_btnmatrix_set_ctrl_map(obj, btnm_state_map);
|
||||||
|
sockfd_can0 = socket_can_close(sockfd_can0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -116,6 +156,39 @@ static void screen_home_btnm_1_event_handler (lv_event_t *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void screen_home_btnm_2_event_handler (lv_event_t *e)
|
||||||
|
{
|
||||||
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
switch (code) {
|
||||||
|
case LV_EVENT_CLICKED:
|
||||||
|
{
|
||||||
|
lv_obj_t * obj = lv_event_get_target(e);
|
||||||
|
uint32_t id = lv_btnmatrix_get_selected_btn(obj);
|
||||||
|
// 获取按钮的文本内容
|
||||||
|
const char *btn_text = lv_btnmatrix_get_btn_text(obj, id);
|
||||||
|
if (btn_text != NULL && btn_text[0] != '\0') {
|
||||||
|
char first_char = btn_text[0]; // 获取按钮文本的第一个字符
|
||||||
|
lv_obj_add_state(last_clicked_textarea, LV_STATE_FOCUSED);
|
||||||
|
switch (id) {
|
||||||
|
case (4):
|
||||||
|
{
|
||||||
|
lv_textarea_del_char(last_clicked_textarea);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
lv_textarea_add_char(last_clicked_textarea,first_char);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void screen_home_win_1_item0_event_handler (lv_event_t *e)
|
static void screen_home_win_1_item0_event_handler (lv_event_t *e)
|
||||||
{
|
{
|
||||||
lv_event_code_t code = lv_event_get_code(e);
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
@ -130,12 +203,49 @@ static void screen_home_win_1_item0_event_handler (lv_event_t *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void screen_home_btn_3_event_handler (lv_event_t *e)
|
||||||
|
{
|
||||||
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
switch (code) {
|
||||||
|
case LV_EVENT_CLICKED:
|
||||||
|
{
|
||||||
|
printf("LV_EVENT_CLICKED\r\n");
|
||||||
|
uint8_t data[8] = {1,2,3,4,5,6,7,8};
|
||||||
|
if(sockfd_can0 != -1)
|
||||||
|
{
|
||||||
|
socket_can_send(sockfd_can0,0x12,data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void screen_home_btn_5_event_handler (lv_event_t *e)
|
||||||
|
{
|
||||||
|
lv_event_code_t code = lv_event_get_code(e);
|
||||||
|
switch (code) {
|
||||||
|
case LV_EVENT_CLICKED:
|
||||||
|
{
|
||||||
|
lv_obj_add_flag(guider_ui.screen_home_cont_1, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void events_init_screen_home (lv_ui *ui)
|
void events_init_screen_home (lv_ui *ui)
|
||||||
{
|
{
|
||||||
lv_obj_add_event_cb(ui->screen_home_ta_2, screen_home_ta_2_event_handler, LV_EVENT_ALL, ui);
|
lv_obj_add_event_cb(ui->screen_home_ta_2, screen_home_ta_2_event_handler, LV_EVENT_ALL, ui);
|
||||||
|
lv_obj_add_event_cb(ui->screen_home_ta_1, screen_home_ta_1_event_handler, LV_EVENT_ALL, ui);
|
||||||
lv_obj_add_event_cb(ui->screen_home_tabview_1, screen_home_tabview_1_event_handler, LV_EVENT_ALL, ui);
|
lv_obj_add_event_cb(ui->screen_home_tabview_1, screen_home_tabview_1_event_handler, LV_EVENT_ALL, ui);
|
||||||
lv_obj_add_event_cb(ui->screen_home_btnm_1, screen_home_btnm_1_event_handler, LV_EVENT_ALL, ui);
|
lv_obj_add_event_cb(ui->screen_home_btnm_1, screen_home_btnm_1_event_handler, LV_EVENT_ALL, ui);
|
||||||
lv_obj_add_event_cb(ui->screen_home_win_1_item0, screen_home_win_1_item0_event_handler, LV_EVENT_ALL, ui);
|
lv_obj_add_event_cb(ui->screen_home_win_1_item0, screen_home_win_1_item0_event_handler, LV_EVENT_ALL, ui);
|
||||||
|
lv_obj_add_event_cb(ui->screen_home_btn_3, screen_home_btn_3_event_handler, LV_EVENT_ALL, ui);
|
||||||
|
lv_obj_add_event_cb(ui->screen_home_btn_5, screen_home_btn_5_event_handler, LV_EVENT_ALL, ui);
|
||||||
|
lv_obj_add_event_cb(ui->screen_home_btnm_2, screen_home_btnm_2_event_handler, LV_EVENT_ALL, ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,15 +20,12 @@ typedef struct
|
|||||||
|
|
||||||
lv_obj_t *screen_logo;
|
lv_obj_t *screen_logo;
|
||||||
bool screen_logo_del;
|
bool screen_logo_del;
|
||||||
lv_obj_t *g_kb_screen_logo;
|
|
||||||
lv_obj_t *screen_logo_cont_1;
|
lv_obj_t *screen_logo_cont_1;
|
||||||
lv_obj_t *screen_logo_btn_1;
|
lv_obj_t *screen_logo_btn_1;
|
||||||
lv_obj_t *screen_logo_btn_1_label;
|
lv_obj_t *screen_logo_btn_1_label;
|
||||||
lv_obj_t *screen_logo_label_1;
|
lv_obj_t *screen_logo_label_1;
|
||||||
lv_obj_t *screen_home;
|
lv_obj_t *screen_home;
|
||||||
bool screen_home_del;
|
bool screen_home_del;
|
||||||
lv_obj_t *g_kb_screen_home;
|
|
||||||
lv_obj_t *screen_home_cont_1;
|
|
||||||
lv_obj_t *screen_home_tabview_2;
|
lv_obj_t *screen_home_tabview_2;
|
||||||
lv_obj_t *screen_home_tabview_2_tab_1;
|
lv_obj_t *screen_home_tabview_2_tab_1;
|
||||||
lv_obj_t *screen_home_tabview_2_tab_2;
|
lv_obj_t *screen_home_tabview_2_tab_2;
|
||||||
@ -54,6 +51,10 @@ typedef struct
|
|||||||
lv_obj_t *screen_home_win_1;
|
lv_obj_t *screen_home_win_1;
|
||||||
lv_obj_t *screen_home_win_1_item0;
|
lv_obj_t *screen_home_win_1_item0;
|
||||||
lv_obj_t *screen_home_led_1;
|
lv_obj_t *screen_home_led_1;
|
||||||
|
lv_obj_t *screen_home_cont_1;
|
||||||
|
lv_obj_t *screen_home_btnm_2;
|
||||||
|
lv_obj_t *screen_home_btn_5;
|
||||||
|
lv_obj_t *screen_home_btn_5_label;
|
||||||
}lv_ui;
|
}lv_ui;
|
||||||
|
|
||||||
typedef void (*ui_setup_scr_t)(lv_ui * ui);
|
typedef void (*ui_setup_scr_t)(lv_ui * ui);
|
||||||
@ -87,7 +88,6 @@ LV_FONT_DECLARE(lv_font_GB2312_12)
|
|||||||
LV_FONT_DECLARE(lv_font_GB2312_24)
|
LV_FONT_DECLARE(lv_font_GB2312_24)
|
||||||
LV_FONT_DECLARE(lv_font_GB2312_18)
|
LV_FONT_DECLARE(lv_font_GB2312_18)
|
||||||
LV_FONT_DECLARE(lv_font_FontAwesome5_12)
|
LV_FONT_DECLARE(lv_font_FontAwesome5_12)
|
||||||
LV_FONT_DECLARE(lv_font_SourceHanSerifSC_Regular_18)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
GEN_CSRCS += lv_font_GB2312_16.c lv_font_montserratMedium_16.c lv_font_montserratMedium_12.c lv_font_montserratMedium_72.c lv_font_GB2312_12.c lv_font_GB2312_24.c lv_font_GB2312_18.c lv_font_FontAwesome5_12.c lv_font_SourceHanSerifSC_Regular_18.c
|
GEN_CSRCS += lv_font_GB2312_16.c lv_font_montserratMedium_16.c lv_font_montserratMedium_12.c lv_font_montserratMedium_72.c lv_font_GB2312_12.c lv_font_GB2312_24.c lv_font_GB2312_18.c lv_font_FontAwesome5_12.c
|
||||||
@ -20,41 +20,18 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
{
|
{
|
||||||
//Write codes screen_home
|
//Write codes screen_home
|
||||||
ui->screen_home = lv_obj_create(NULL);
|
ui->screen_home = lv_obj_create(NULL);
|
||||||
ui->g_kb_screen_home = lv_keyboard_create(ui->screen_home);
|
|
||||||
lv_obj_add_event_cb(ui->g_kb_screen_home, kb_event_cb, LV_EVENT_ALL, NULL);
|
|
||||||
lv_obj_add_flag(ui->g_kb_screen_home, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
lv_obj_set_style_text_font(ui->g_kb_screen_home, &lv_font_SourceHanSerifSC_Regular_18, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_size(ui->screen_home, 1280, 720);
|
lv_obj_set_size(ui->screen_home, 1280, 720);
|
||||||
lv_obj_set_scrollbar_mode(ui->screen_home, LV_SCROLLBAR_MODE_OFF);
|
lv_obj_set_scrollbar_mode(ui->screen_home, LV_SCROLLBAR_MODE_OFF);
|
||||||
|
|
||||||
//Write style for screen_home, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
//Write style for screen_home, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
lv_obj_set_style_bg_opa(ui->screen_home, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_opa(ui->screen_home, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_color(ui->screen_home, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
//Write codes screen_home_cont_1
|
lv_obj_set_style_bg_grad_dir(ui->screen_home, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
ui->screen_home_cont_1 = lv_obj_create(ui->screen_home);
|
|
||||||
lv_obj_set_pos(ui->screen_home_cont_1, 907, 411);
|
|
||||||
lv_obj_set_size(ui->screen_home_cont_1, 373, 307);
|
|
||||||
lv_obj_set_scrollbar_mode(ui->screen_home_cont_1, LV_SCROLLBAR_MODE_OFF);
|
|
||||||
|
|
||||||
//Write style for screen_home_cont_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
|
||||||
lv_obj_set_style_border_width(ui->screen_home_cont_1, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_border_opa(ui->screen_home_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_border_color(ui->screen_home_cont_1, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_border_side(ui->screen_home_cont_1, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_radius(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_bg_opa(ui->screen_home_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_bg_color(ui->screen_home_cont_1, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_bg_grad_dir(ui->screen_home_cont_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_pad_top(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_pad_bottom(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_pad_left(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_pad_right(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_style_shadow_width(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
|
|
||||||
//Write codes screen_home_tabview_2
|
//Write codes screen_home_tabview_2
|
||||||
ui->screen_home_tabview_2 = lv_tabview_create(ui->screen_home, LV_DIR_TOP, 50);
|
ui->screen_home_tabview_2 = lv_tabview_create(ui->screen_home, LV_DIR_TOP, 50);
|
||||||
lv_obj_set_pos(ui->screen_home_tabview_2, 912, 4);
|
lv_obj_set_pos(ui->screen_home_tabview_2, 900, 0);
|
||||||
lv_obj_set_size(ui->screen_home_tabview_2, 364, 397);
|
lv_obj_set_size(ui->screen_home_tabview_2, 380, 400);
|
||||||
lv_obj_set_scrollbar_mode(ui->screen_home_tabview_2, LV_SCROLLBAR_MODE_OFF);
|
lv_obj_set_scrollbar_mode(ui->screen_home_tabview_2, LV_SCROLLBAR_MODE_OFF);
|
||||||
|
|
||||||
//Write style for screen_home_tabview_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
//Write style for screen_home_tabview_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
@ -137,18 +114,16 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
|
|
||||||
//Write codes screen_home_ta_2
|
//Write codes screen_home_ta_2
|
||||||
ui->screen_home_ta_2 = lv_textarea_create(ui->screen_home_tabview_2_tab_1);
|
ui->screen_home_ta_2 = lv_textarea_create(ui->screen_home_tabview_2_tab_1);
|
||||||
lv_textarea_set_text(ui->screen_home_ta_2, "00 01 02 03 04 05 06 07 ");
|
lv_textarea_set_text(ui->screen_home_ta_2, "00 01 02 03 04 05 06");
|
||||||
lv_textarea_set_placeholder_text(ui->screen_home_ta_2, "");
|
lv_textarea_set_placeholder_text(ui->screen_home_ta_2, "");
|
||||||
lv_textarea_set_password_bullet(ui->screen_home_ta_2, "*");
|
lv_textarea_set_password_bullet(ui->screen_home_ta_2, "*");
|
||||||
lv_textarea_set_password_mode(ui->screen_home_ta_2, false);
|
lv_textarea_set_password_mode(ui->screen_home_ta_2, false);
|
||||||
lv_textarea_set_one_line(ui->screen_home_ta_2, true);
|
lv_textarea_set_one_line(ui->screen_home_ta_2, true);
|
||||||
lv_textarea_set_accepted_chars(ui->screen_home_ta_2, "");
|
lv_textarea_set_accepted_chars(ui->screen_home_ta_2, "");
|
||||||
lv_textarea_set_max_length(ui->screen_home_ta_2, 33);
|
lv_textarea_set_max_length(ui->screen_home_ta_2, 33);
|
||||||
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
|
lv_obj_add_state(ui->screen_home_ta_2, LV_STATE_FOCUSED); /*To be sure the cursor is visible*/
|
||||||
lv_obj_add_event_cb(ui->screen_home_ta_2, ta_event_cb, LV_EVENT_ALL, ui->g_kb_screen_home);
|
|
||||||
#endif
|
|
||||||
lv_obj_set_pos(ui->screen_home_ta_2, 82, 99);
|
lv_obj_set_pos(ui->screen_home_ta_2, 82, 99);
|
||||||
lv_obj_set_size(ui->screen_home_ta_2, 250, 31);
|
lv_obj_set_size(ui->screen_home_ta_2, 250, 36);
|
||||||
|
|
||||||
//Write style for screen_home_ta_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
//Write style for screen_home_ta_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
lv_obj_set_style_text_color(ui->screen_home_ta_2, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_text_color(ui->screen_home_ta_2, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
@ -156,7 +131,7 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
lv_obj_set_style_text_opa(ui->screen_home_ta_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_text_opa(ui->screen_home_ta_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_text_letter_space(ui->screen_home_ta_2, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_text_letter_space(ui->screen_home_ta_2, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_text_align(ui->screen_home_ta_2, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_text_align(ui->screen_home_ta_2, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_bg_opa(ui->screen_home_ta_2, 0, LV_PART_SCROLLBAR | LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_opa(ui->screen_home_ta_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_bg_color(ui->screen_home_ta_2, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_color(ui->screen_home_ta_2, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_bg_grad_dir(ui->screen_home_ta_2, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_ta_2, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_border_width(ui->screen_home_ta_2, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_border_width(ui->screen_home_ta_2, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
@ -170,10 +145,14 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
lv_obj_set_style_pad_left(ui->screen_home_ta_2, 4, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_pad_left(ui->screen_home_ta_2, 4, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
//Write style for screen_home_ta_2, Part: LV_PART_SCROLLBAR, State: LV_STATE_DEFAULT.
|
//Write style for screen_home_ta_2, Part: LV_PART_SCROLLBAR, State: LV_STATE_DEFAULT.
|
||||||
lv_obj_set_style_bg_opa(ui->screen_home_ta_2, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_opa(ui->screen_home_ta_2, 255, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_bg_color(ui->screen_home_ta_2, lv_color_hex(0x2195f6), LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_color(ui->screen_home_ta_2, lv_color_hex(0x2195f6), LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_bg_grad_dir(ui->screen_home_ta_2, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_ta_2, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_radius(ui->screen_home_ta_2, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
lv_obj_set_style_radius(ui->screen_home_ta_2, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_clear_flag(ui->screen_home_ta_2, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
|
lv_obj_set_scrollbar_mode(ui->screen_home_ta_2, LV_SCROLLBAR_MODE_OFF);
|
||||||
|
lv_obj_set_scroll_dir(ui->screen_home_ta_2, LV_DIR_NONE); // 禁止所有方向的滚动
|
||||||
|
|
||||||
|
|
||||||
//Write codes screen_home_label_5
|
//Write codes screen_home_label_5
|
||||||
ui->screen_home_label_5 = lv_label_create(ui->screen_home_tabview_2_tab_1);
|
ui->screen_home_label_5 = lv_label_create(ui->screen_home_tabview_2_tab_1);
|
||||||
@ -207,11 +186,9 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
lv_textarea_set_one_line(ui->screen_home_ta_1, true);
|
lv_textarea_set_one_line(ui->screen_home_ta_1, true);
|
||||||
lv_textarea_set_accepted_chars(ui->screen_home_ta_1, "");
|
lv_textarea_set_accepted_chars(ui->screen_home_ta_1, "");
|
||||||
lv_textarea_set_max_length(ui->screen_home_ta_1, 8);
|
lv_textarea_set_max_length(ui->screen_home_ta_1, 8);
|
||||||
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
|
lv_obj_add_state(ui->screen_home_ta_1, LV_STATE_FOCUSED); /*To be sure the cursor is visible*/
|
||||||
lv_obj_add_event_cb(ui->screen_home_ta_1, ta_event_cb, LV_EVENT_ALL, ui->g_kb_screen_home);
|
lv_obj_set_pos(ui->screen_home_ta_1, 193, 62);
|
||||||
#endif
|
lv_obj_set_size(ui->screen_home_ta_1, 109, 36);
|
||||||
lv_obj_set_pos(ui->screen_home_ta_1, 193, 67);
|
|
||||||
lv_obj_set_size(ui->screen_home_ta_1, 109, 27);
|
|
||||||
|
|
||||||
//Write style for screen_home_ta_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
//Write style for screen_home_ta_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
lv_obj_set_style_text_color(ui->screen_home_ta_1, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_text_color(ui->screen_home_ta_1, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
@ -238,6 +215,8 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
lv_obj_set_style_bg_grad_dir(ui->screen_home_ta_1, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_ta_1, LV_GRAD_DIR_NONE, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_radius(ui->screen_home_ta_1, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
lv_obj_set_style_radius(ui->screen_home_ta_1, 0, LV_PART_SCROLLBAR|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
|
lv_obj_clear_flag(ui->screen_home_ta_1, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
|
|
||||||
//Write codes screen_home_label_4
|
//Write codes screen_home_label_4
|
||||||
ui->screen_home_label_4 = lv_label_create(ui->screen_home_tabview_2_tab_1);
|
ui->screen_home_label_4 = lv_label_create(ui->screen_home_tabview_2_tab_1);
|
||||||
lv_label_set_text(ui->screen_home_label_4, "帧ID(HEX):");
|
lv_label_set_text(ui->screen_home_label_4, "帧ID(HEX):");
|
||||||
@ -635,7 +614,7 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
//Write codes screen_home_tabview_1
|
//Write codes screen_home_tabview_1
|
||||||
ui->screen_home_tabview_1 = lv_tabview_create(ui->screen_home, LV_DIR_TOP, 50);
|
ui->screen_home_tabview_1 = lv_tabview_create(ui->screen_home, LV_DIR_TOP, 50);
|
||||||
lv_obj_set_pos(ui->screen_home_tabview_1, 0, 0);
|
lv_obj_set_pos(ui->screen_home_tabview_1, 0, 0);
|
||||||
lv_obj_set_size(ui->screen_home_tabview_1, 903, 660);
|
lv_obj_set_size(ui->screen_home_tabview_1, 900, 660);
|
||||||
lv_obj_set_scrollbar_mode(ui->screen_home_tabview_1, LV_SCROLLBAR_MODE_OFF);
|
lv_obj_set_scrollbar_mode(ui->screen_home_tabview_1, LV_SCROLLBAR_MODE_OFF);
|
||||||
|
|
||||||
//Write style for screen_home_tabview_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
//Write style for screen_home_tabview_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
@ -766,10 +745,7 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
lv_obj_set_style_bg_grad_dir(ui->screen_home_btnm_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_btnm_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
//Write style for screen_home_btnm_1, Part: LV_PART_MAIN, State: LV_STATE_FOCUSED.
|
//Write style for screen_home_btnm_1, Part: LV_PART_MAIN, State: LV_STATE_FOCUSED.
|
||||||
lv_obj_set_style_border_width(ui->screen_home_btnm_1, 1, LV_PART_MAIN|LV_STATE_FOCUSED);
|
lv_obj_set_style_border_width(ui->screen_home_btnm_1, 0, LV_PART_MAIN|LV_STATE_FOCUSED);
|
||||||
lv_obj_set_style_border_opa(ui->screen_home_btnm_1, 255, LV_PART_MAIN|LV_STATE_FOCUSED);
|
|
||||||
lv_obj_set_style_border_color(ui->screen_home_btnm_1, lv_color_hex(0xc9c9c9), LV_PART_MAIN|LV_STATE_FOCUSED);
|
|
||||||
lv_obj_set_style_border_side(ui->screen_home_btnm_1, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_FOCUSED);
|
|
||||||
lv_obj_set_style_pad_top(ui->screen_home_btnm_1, 0, LV_PART_MAIN|LV_STATE_FOCUSED);
|
lv_obj_set_style_pad_top(ui->screen_home_btnm_1, 0, LV_PART_MAIN|LV_STATE_FOCUSED);
|
||||||
lv_obj_set_style_pad_bottom(ui->screen_home_btnm_1, 0, LV_PART_MAIN|LV_STATE_FOCUSED);
|
lv_obj_set_style_pad_bottom(ui->screen_home_btnm_1, 0, LV_PART_MAIN|LV_STATE_FOCUSED);
|
||||||
lv_obj_set_style_pad_left(ui->screen_home_btnm_1, 10, LV_PART_MAIN|LV_STATE_FOCUSED);
|
lv_obj_set_style_pad_left(ui->screen_home_btnm_1, 10, LV_PART_MAIN|LV_STATE_FOCUSED);
|
||||||
@ -910,6 +886,88 @@ void setup_scr_screen_home(lv_ui *ui)
|
|||||||
lv_obj_set_pos(ui->screen_home_led_1, 15, 679);
|
lv_obj_set_pos(ui->screen_home_led_1, 15, 679);
|
||||||
lv_obj_set_size(ui->screen_home_led_1, 42, 26);
|
lv_obj_set_size(ui->screen_home_led_1, 42, 26);
|
||||||
|
|
||||||
|
//Write codes screen_home_cont_1
|
||||||
|
ui->screen_home_cont_1 = lv_obj_create(ui->screen_home);
|
||||||
|
lv_obj_set_pos(ui->screen_home_cont_1, 906, 211);
|
||||||
|
lv_obj_set_size(ui->screen_home_cont_1, 373, 503);
|
||||||
|
lv_obj_set_scrollbar_mode(ui->screen_home_cont_1, LV_SCROLLBAR_MODE_OFF);
|
||||||
|
lv_obj_add_flag(ui->screen_home_cont_1, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
|
//Write style for screen_home_cont_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
|
lv_obj_set_style_border_width(ui->screen_home_cont_1, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_opa(ui->screen_home_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_color(ui->screen_home_cont_1, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_side(ui->screen_home_cont_1, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_radius(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_opa(ui->screen_home_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_color(ui->screen_home_cont_1, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_cont_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_top(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_bottom(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_left(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_right(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_shadow_width(ui->screen_home_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
|
//Write codes screen_home_btnm_2
|
||||||
|
ui->screen_home_btnm_2 = lv_btnmatrix_create(ui->screen_home_cont_1);
|
||||||
|
static const char *screen_home_btnm_2_text_map[] = {"A", "1", "2", "3", LV_SYMBOL_BACKSPACE, "\n", "B", "4", "5", "6", "<", "\n", "C", "7", "8", "9", ">", "\n", "D", "E", "F", "0", " ", "",};
|
||||||
|
lv_btnmatrix_set_map(ui->screen_home_btnm_2, screen_home_btnm_2_text_map);
|
||||||
|
lv_obj_set_pos(ui->screen_home_btnm_2, 35, 61);
|
||||||
|
lv_obj_set_size(ui->screen_home_btnm_2, 312, 332);
|
||||||
|
|
||||||
|
//Write style for screen_home_btnm_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
|
lv_obj_set_style_border_width(ui->screen_home_btnm_2, 1, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_opa(ui->screen_home_btnm_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_color(ui->screen_home_btnm_2, lv_color_hex(0xc9c9c9), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_side(ui->screen_home_btnm_2, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_top(ui->screen_home_btnm_2, 16, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_bottom(ui->screen_home_btnm_2, 16, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_left(ui->screen_home_btnm_2, 16, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_right(ui->screen_home_btnm_2, 16, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_row(ui->screen_home_btnm_2, 8, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_pad_column(ui->screen_home_btnm_2, 8, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_radius(ui->screen_home_btnm_2, 4, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_opa(ui->screen_home_btnm_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_color(ui->screen_home_btnm_2, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_btnm_2, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
|
//Write style for screen_home_btnm_2, Part: LV_PART_ITEMS, State: LV_STATE_DEFAULT.
|
||||||
|
lv_obj_set_style_border_width(ui->screen_home_btnm_2, 1, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_opa(ui->screen_home_btnm_2, 255, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_color(ui->screen_home_btnm_2, lv_color_hex(0xc9c9c9), LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_side(ui->screen_home_btnm_2, LV_BORDER_SIDE_FULL, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_color(ui->screen_home_btnm_2, lv_color_hex(0xffffff), LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_font(ui->screen_home_btnm_2, &lv_font_GB2312_16, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_opa(ui->screen_home_btnm_2, 255, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_radius(ui->screen_home_btnm_2, 4, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_opa(ui->screen_home_btnm_2, 255, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_color(ui->screen_home_btnm_2, lv_color_hex(0x2195f6), LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_btnm_2, LV_GRAD_DIR_NONE, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_shadow_width(ui->screen_home_btnm_2, 0, LV_PART_ITEMS|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
|
//Write codes screen_home_btn_5
|
||||||
|
ui->screen_home_btn_5 = lv_btn_create(ui->screen_home_cont_1);
|
||||||
|
ui->screen_home_btn_5_label = lv_label_create(ui->screen_home_btn_5);
|
||||||
|
lv_label_set_text(ui->screen_home_btn_5_label, "" LV_SYMBOL_CLOSE "");
|
||||||
|
lv_label_set_long_mode(ui->screen_home_btn_5_label, LV_LABEL_LONG_WRAP);
|
||||||
|
lv_obj_align(ui->screen_home_btn_5_label, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
lv_obj_set_style_pad_all(ui->screen_home_btn_5, 0, LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_width(ui->screen_home_btn_5_label, LV_PCT(100));
|
||||||
|
lv_obj_set_pos(ui->screen_home_btn_5, 305, 13);
|
||||||
|
lv_obj_set_size(ui->screen_home_btn_5, 50, 36);
|
||||||
|
|
||||||
|
//Write style for screen_home_btn_5, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
|
||||||
|
lv_obj_set_style_bg_opa(ui->screen_home_btn_5, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_color(ui->screen_home_btn_5, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_bg_grad_dir(ui->screen_home_btn_5, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_border_width(ui->screen_home_btn_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_radius(ui->screen_home_btn_5, 5, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_shadow_width(ui->screen_home_btn_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_color(ui->screen_home_btn_5, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_font(ui->screen_home_btn_5, &lv_font_GB2312_16, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_opa(ui->screen_home_btn_5, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
lv_obj_set_style_text_align(ui->screen_home_btn_5, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
|
||||||
|
|
||||||
//The custom code of screen_home.
|
//The custom code of screen_home.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,10 +20,6 @@ void setup_scr_screen_logo(lv_ui *ui)
|
|||||||
{
|
{
|
||||||
//Write codes screen_logo
|
//Write codes screen_logo
|
||||||
ui->screen_logo = lv_obj_create(NULL);
|
ui->screen_logo = lv_obj_create(NULL);
|
||||||
ui->g_kb_screen_logo = lv_keyboard_create(ui->screen_logo);
|
|
||||||
lv_obj_add_event_cb(ui->g_kb_screen_logo, kb_event_cb, LV_EVENT_ALL, NULL);
|
|
||||||
lv_obj_add_flag(ui->g_kb_screen_logo, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
lv_obj_set_style_text_font(ui->g_kb_screen_logo, &lv_font_SourceHanSerifSC_Regular_18, LV_PART_MAIN|LV_STATE_DEFAULT);
|
|
||||||
lv_obj_set_size(ui->screen_logo, 1280, 720);
|
lv_obj_set_size(ui->screen_logo, 1280, 720);
|
||||||
lv_obj_set_scrollbar_mode(ui->screen_logo, LV_SCROLLBAR_MODE_OFF);
|
lv_obj_set_scrollbar_mode(ui->screen_logo, LV_SCROLLBAR_MODE_OFF);
|
||||||
|
|
||||||
|
|||||||
118
main_app/Socket_can.c
Normal file
118
main_app/Socket_can.c
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <linux/can.h>
|
||||||
|
#include <linux/can/raw.h>
|
||||||
|
|
||||||
|
int sockfd_can0;
|
||||||
|
|
||||||
|
int socket_can_init(char* can_dev)
|
||||||
|
{
|
||||||
|
int sockfd_can;
|
||||||
|
struct ifreq ifr;
|
||||||
|
struct sockaddr_can addr;
|
||||||
|
|
||||||
|
sockfd_can = socket(PF_CAN, SOCK_RAW, CAN_RAW);
|
||||||
|
if (sockfd_can < 0) {
|
||||||
|
perror("Error while opening socket");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(ifr.ifr_name, can_dev);
|
||||||
|
ioctl(sockfd_can, SIOCGIFINDEX, &ifr);
|
||||||
|
|
||||||
|
// 绑定 CAN 套接字到接口
|
||||||
|
addr.can_family = AF_CAN;
|
||||||
|
addr.can_ifindex = ifr.ifr_ifindex;
|
||||||
|
if (bind(sockfd_can, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
|
perror("Error in socket bind");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sockfd_can;
|
||||||
|
}
|
||||||
|
|
||||||
|
int socket_can_send(int sockfd,uint32_t can_id,uint8_t data[8])
|
||||||
|
{
|
||||||
|
struct can_frame frame;
|
||||||
|
// 准备发送的 CAN 帧
|
||||||
|
frame.can_id = can_id; // 11位标准帧ID
|
||||||
|
frame.can_dlc = 8; // 数据长度为8字节
|
||||||
|
|
||||||
|
// 使用循环赋值 CAN 数据帧
|
||||||
|
for (int i = 0; i < frame.can_dlc; i++)
|
||||||
|
{
|
||||||
|
frame.data[i] = data[i]; // 将数据从0x01到0x08依次赋值
|
||||||
|
}
|
||||||
|
|
||||||
|
if (write(sockfd, &frame, sizeof(struct can_frame)) != sizeof(struct can_frame)) {
|
||||||
|
perror("Write error");
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int socket_can_close(int sockfd)
|
||||||
|
{
|
||||||
|
// 关闭套接字
|
||||||
|
close(sockfd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int test() {
|
||||||
|
int sockfd;
|
||||||
|
struct sockaddr_can addr;
|
||||||
|
struct ifreq ifr;
|
||||||
|
struct can_frame frame;
|
||||||
|
|
||||||
|
// 创建 CAN 套接字
|
||||||
|
sockfd = socket(PF_CAN, SOCK_RAW, CAN_RAW);
|
||||||
|
if (sockfd < 0) {
|
||||||
|
perror("Error while opening socket");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 指定 CAN 接口(假设为 can0)
|
||||||
|
strcpy(ifr.ifr_name, "can0");
|
||||||
|
ioctl(sockfd, SIOCGIFINDEX, &ifr);
|
||||||
|
|
||||||
|
// 绑定 CAN 套接字到接口
|
||||||
|
addr.can_family = AF_CAN;
|
||||||
|
addr.can_ifindex = ifr.ifr_ifindex;
|
||||||
|
if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
|
perror("Error in socket bind");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 准备发送的 CAN 帧
|
||||||
|
frame.can_id = 0x123; // 11位标准帧ID
|
||||||
|
frame.can_dlc = 8; // 数据长度为8字节
|
||||||
|
// 使用循环赋值 CAN 数据帧
|
||||||
|
for (int i = 0; i < frame.can_dlc; i++)
|
||||||
|
{
|
||||||
|
frame.data[i] = i + 1; // 将数据从0x01到0x08依次赋值
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 发送 CAN 帧
|
||||||
|
for(int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
if (write(sockfd, &frame, sizeof(struct can_frame)) != sizeof(struct can_frame)) {
|
||||||
|
perror("Write error");
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("CAN message sent on can0\n");
|
||||||
|
// 关闭套接字
|
||||||
|
close(sockfd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
10
main_app/Socket_can.h
Normal file
10
main_app/Socket_can.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef SOCKET_CAN_H
|
||||||
|
#define SOCKET_CAN_H
|
||||||
|
|
||||||
|
extern int socket_can_init(char* can_dev);
|
||||||
|
extern int socket_can_send(int sockfd,uint32_t can_id,uint8_t data[8]);
|
||||||
|
extern int socket_can_close(int sockfd);
|
||||||
|
|
||||||
|
extern int sockfd_can0;
|
||||||
|
|
||||||
|
#endif
|
||||||
32
tools/S50Socket-CAN-UP.sh
Normal file
32
tools/S50Socket-CAN-UP.sh
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 检查参数数量
|
||||||
|
if [ "$#" -ne 3 ]; then
|
||||||
|
echo "用法: $0 <CAN接口> <波特率> <数据波特率>"
|
||||||
|
echo "示例: $0 can0 500000 2000000"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 获取参数
|
||||||
|
CAN_INTERFACE=$1
|
||||||
|
BITRATE=$2
|
||||||
|
DBITRATE=$3
|
||||||
|
|
||||||
|
# 关闭 CAN 接口
|
||||||
|
ip link set $CAN_INTERFACE down
|
||||||
|
|
||||||
|
# 配置 CAN 接口
|
||||||
|
ip link set $CAN_INTERFACE type can bitrate $BITRATE dbitrate $DBITRATE fd on
|
||||||
|
|
||||||
|
# 启用 CAN 接口
|
||||||
|
ip link set $CAN_INTERFACE up
|
||||||
|
|
||||||
|
# 检查是否配置成功
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "CAN 接口 $CAN_INTERFACE 已成功配置:"
|
||||||
|
echo "波特率: $BITRATE"
|
||||||
|
echo "数据波特率: $DBITRATE"
|
||||||
|
else
|
||||||
|
echo "CAN 接口 $CAN_INTERFACE 配置失败!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue
Block a user