Skip to content

Commit

Permalink
update 2023-10-20
Browse files Browse the repository at this point in the history
  • Loading branch information
jiale-gdyd committed Oct 20, 2023
1 parent 99fe019 commit 5524c4b
Show file tree
Hide file tree
Showing 29 changed files with 2,081 additions and 173 deletions.
17 changes: 11 additions & 6 deletions project/entry/gui_demo/lvgl/widget/widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ static lv_obj_t * create_chart_with_scales(lv_obj_t * parent, const char * title
lv_obj_t * scale_ver = lv_scale_create(parent);
lv_scale_set_mode(scale_ver, LV_SCALE_MODE_VERTICAL_LEFT);
lv_obj_set_grid_cell(scale_ver, LV_GRID_ALIGN_END, 0, 1, LV_GRID_ALIGN_STRETCH, 1, 1);
lv_scale_set_total_tick_count(scale_ver, 10);
lv_scale_set_total_tick_count(scale_ver, 11);
lv_scale_set_major_tick_every(scale_ver, 2);
lv_scale_set_range(scale_ver, 0, 100);

Expand All @@ -567,7 +567,7 @@ static lv_obj_t * create_chart_with_scales(lv_obj_t * parent, const char * title
lv_obj_t * scale_hor = lv_scale_create(wrapper);
lv_scale_set_mode(scale_hor, LV_SCALE_MODE_HORIZONTAL_BOTTOM);
lv_obj_set_grid_cell(scale_hor, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 1, 1);
lv_scale_set_total_tick_count(scale_hor, 11);
lv_scale_set_total_tick_count(scale_hor, 12);
lv_scale_set_major_tick_every(scale_hor, 1);
lv_scale_set_text_src(scale_hor, hor_text);
lv_obj_set_width(scale_hor, lv_pct(200));
Expand Down Expand Up @@ -652,6 +652,7 @@ static void analytics_create(lv_obj_t * parent)
lv_obj_t * arc;
arc = lv_arc_create(scale1);
lv_obj_remove_style(arc, NULL, LV_PART_KNOB);
lv_obj_remove_style(arc, NULL, LV_PART_MAIN);
lv_obj_set_size(arc, lv_pct(100), lv_pct(100));
lv_obj_set_style_arc_opa(arc, 0, 0);
lv_obj_set_style_arc_width(arc, 15, LV_PART_INDICATOR);
Expand Down Expand Up @@ -697,15 +698,17 @@ static void analytics_create(lv_obj_t * parent)
lv_anim_start(&a);

/*Scale 2*/
lv_scale_set_round_props(scale2, 330, 0);
lv_scale_set_total_tick_count(scale2, 10);
static const char * scale2_text[] = {"0", "10", "20", "30", "40", "50", "60", "70", "80", "90", NULL};
lv_scale_set_round_props(scale2, 360, 0);
lv_scale_set_text_src(scale2, scale2_text);
lv_scale_set_total_tick_count(scale2, 11);
lv_scale_set_major_tick_length(scale2, 30);
lv_scale_set_major_tick_every(scale2, 1);
arc = lv_arc_create(scale2);
lv_obj_set_size(arc, lv_pct(100), lv_pct(100));
lv_obj_set_style_margin_all(arc, 10, 0);
lv_obj_set_style_bg_opa(arc, 0, LV_PART_KNOB);
lv_obj_set_style_bg_opa(arc, 0, LV_PART_KNOB);
lv_obj_set_style_arc_opa(arc, 0, LV_PART_MAIN);
lv_obj_set_style_arc_width(arc, 10, LV_PART_INDICATOR);
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_BLUE), LV_PART_INDICATOR);
Expand All @@ -717,6 +720,7 @@ static void analytics_create(lv_obj_t * parent)
lv_obj_set_style_margin_all(arc, 5, 0);
lv_obj_set_style_arc_opa(arc, 0, 0);
lv_obj_set_style_bg_opa(arc, 0, LV_PART_KNOB);
lv_obj_set_style_arc_opa(arc, 0, LV_PART_MAIN);
lv_obj_set_style_arc_width(arc, 20, LV_PART_INDICATOR);
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_RED), LV_PART_INDICATOR);
Expand All @@ -727,6 +731,7 @@ static void analytics_create(lv_obj_t * parent)
lv_obj_set_size(arc, lv_pct(100), lv_pct(100));
lv_obj_set_style_arc_opa(arc, 0, 0);
lv_obj_set_style_bg_opa(arc, 0, LV_PART_KNOB);
lv_obj_set_style_arc_opa(arc, 0, LV_PART_MAIN);
lv_obj_set_style_arc_width(arc, 30, LV_PART_INDICATOR);
lv_obj_set_style_arc_rounded(arc, false, LV_PART_INDICATOR);
lv_obj_set_style_arc_color(arc, lv_palette_main(LV_PALETTE_GREEN), LV_PART_INDICATOR);
Expand All @@ -738,7 +743,7 @@ static void analytics_create(lv_obj_t * parent)

/*Scale 3*/
lv_scale_set_range(scale3, 10, 60);
lv_scale_set_total_tick_count(scale3, 20);
lv_scale_set_total_tick_count(scale3, 21);
lv_scale_set_major_tick_every(scale3, 4);
lv_scale_set_minor_tick_length(scale3, 10);
lv_scale_set_major_tick_length(scale3, 20);
Expand Down
35 changes: 34 additions & 1 deletion project/gui/awtk/src/conf_io/conf_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,4 +1097,37 @@ ret_t conf_node_get_child_value_by_index(conf_node_t* node, uint32_t index, valu
return_value_if_fail(child != NULL && v != NULL, RET_BAD_PARAMS);

return conf_node_get_value(child, v);
}
}

int32_t conf_node_get_child_value_int32(conf_node_t* node, const char* name, int32_t defval) {
value_t v;
return_value_if_fail(node != NULL && name != NULL, defval);

if(conf_node_get_child_value(node, name, &v) == RET_OK) {
return value_int32(&v);
} else {
return defval;
}
}

bool_t conf_node_get_child_value_bool(conf_node_t* node, const char* name, bool_t defval) {
value_t v;
return_value_if_fail(node != NULL && name != NULL, defval);

if(conf_node_get_child_value(node, name, &v) == RET_OK) {
return value_bool(&v);
} else {
return defval;
}
}

const char* conf_node_get_child_value_str(conf_node_t* node, const char* name, const char* defval) {
value_t v;
return_value_if_fail(node != NULL && name != NULL, defval);

if(conf_node_get_child_value(node, name, &v) == RET_OK) {
return value_str(&v);
} else {
return defval;
}
}
43 changes: 41 additions & 2 deletions project/gui/awtk/src/conf_io/conf_node.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* File: conf_node.h
* Author: AWTK Develop Team
* Brief: conf node
Expand Down Expand Up @@ -731,6 +731,45 @@ ret_t conf_node_get_value(conf_node_t* node, value_t* v);
*/
ret_t conf_node_get_child_value(conf_node_t* node, const char* name, value_t* v);

/**
* @method conf_node_get_child_value_int32
*
* 获取子节点的值。
*
* @param {conf_node_t*} node 节点对象。
* @param {const char*} name 子节点名称。
* @param {int32_t} defval 默认值。
*
* @return {int32_t} 返回值。
*/
int32_t conf_node_get_child_value_int32(conf_node_t* node, const char* name, int32_t defval);

/**
* @method conf_node_get_child_value_bool
*
* 获取子节点的值。
*
* @param {conf_node_t*} node 节点对象。
* @param {const char*} name 子节点名称。
* @param {bool_t} defval 默认值。
*
* @return {bool_t} 返回值。
*/
bool_t conf_node_get_child_value_bool(conf_node_t* node, const char* name, bool_t defval);

/**
* @method conf_node_get_child_value_str
*
* 获取子节点的值。
*
* @param {conf_node_t*} node 节点对象。
* @param {const char*} name 子节点名称。
* @param {const char*} defval 默认值。
*
* @return {const char*} 返回值。
*/
const char* conf_node_get_child_value_str(conf_node_t* node, const char* name, const char* defval);

/**
* @method conf_node_get_child_value_by_index
*
Expand Down Expand Up @@ -790,4 +829,4 @@ ret_t conf_doc_get_value_extend_type(conf_doc_t* doc, conf_node_t* node, value_t

END_C_DECLS

#endif /*TK_CONF_NODE_H*/
#endif /*TK_CONF_NODE_H*/
8 changes: 5 additions & 3 deletions project/gui/awtk/src/debugger/debugger_lldb.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* File: debugger_server.h
* Author: AWTK Develop Team
* Brief: debugger server
Expand Down Expand Up @@ -957,9 +957,11 @@ static ret_t debugger_lldb_load_source(debugger_t* debugger, const char* path) {
if (source != NULL) {
tk_object_set_prop_str(lldb->sources, path, source);
TKMEM_FREE(source);
} else {
log_debug("read source failed:%s\n", path);
}
} else {
log_debug("read source failed:%s\n", path);
log_debug("get source cache ok:%s\n", path);
}
lldb->current_frame_source = tk_object_get_prop_str(lldb->sources, path);
} else {
Expand Down Expand Up @@ -1357,4 +1359,4 @@ debugger_t* debugger_lldb_create(const char* host, uint32_t port) {
}

return debugger;
}
}
34 changes: 32 additions & 2 deletions project/gui/awtk/src/tkc/fs.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
/**
* File: fs.h
* Author: AWTK Develop Team
* Brief: simple fs api
*
* Copyright (c) 2018 - 2022 Guangzhou ZHIYUAN Electronics Co.,Ltd.
* Copyright (c) 2018 - 2023 Guangzhou ZHIYUAN Electronics Co.,Ltd.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
Expand All @@ -24,6 +24,36 @@
#include "tkc/utils.h"
#include "tkc/path.h"

fs_stat_info_t* fs_stat_info_create(void) {
fs_stat_info_t* ret = TKMEM_ZALLOC(fs_stat_info_t);
return_value_if_fail(ret != NULL, NULL);

return ret;
}

ret_t fs_stat_info_destroy(fs_stat_info_t* fst) {
return_value_if_fail(fst != NULL, RET_BAD_PARAMS);

TKMEM_FREE(fst);

return RET_OK;
}

fs_item_t* fs_item_create(void) {
fs_item_t* ret = TKMEM_ZALLOC(fs_item_t);
return_value_if_fail(ret != NULL, NULL);

return ret;
}

ret_t fs_item_destroy(fs_item_t* item) {
return_value_if_fail(item != NULL, RET_BAD_PARAMS);

TKMEM_FREE(item);

return RET_OK;
}

int32_t fs_file_read(fs_file_t* file, void* buffer, uint32_t size) {
return_value_if_fail(file != NULL && file->vt != NULL && buffer != NULL && file->vt->read != NULL,
-1);
Expand Down
40 changes: 38 additions & 2 deletions project/gui/awtk/src/tkc/fs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* File: fs.h
* Author: AWTK Develop Team
* Brief: simple fs api
Expand Down Expand Up @@ -77,6 +77,21 @@ typedef struct _fs_stat_info_t {
bool_t is_reg_file;
} fs_stat_info_t;

/**
* @method fs_stat_info_create
* 创建文件状态信息对象。
* @return {fs_stat_info_t*} 返回文件状态信息对象。
*/
fs_stat_info_t* fs_stat_info_create(void);

/**
* @method fs_stat_info_destroy
* 销毁文件状态信息对象。
* @param {fs_stat_info_t*} fst 文件状态信息对象。
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
*/
ret_t fs_stat_info_destroy(fs_stat_info_t* fst);

struct _fs_file_t;
typedef struct _fs_file_t fs_file_t;

Expand Down Expand Up @@ -119,6 +134,7 @@ typedef struct _fs_file_vtable_t {
* int32_t len = file_get_size(file_name);
* uint8_t* buff = (uint8_t*)TKMEM_ALLOC(len + 1);
* return_value_if_fail(buff != NULL, NULL);
* fs_file_t* fp = fs_open_file(os_fs(), file_name, "rb");
* if (fp != NULL) {
* ret = fs_file_read(fp, buff, len);
Expand Down Expand Up @@ -306,6 +322,26 @@ typedef struct _fs_item_t {
char name[MAX_PATH + 1];
} fs_item_t;

/**
* @method fs_item_create
*
* 创建文件或目录对象。
*
* @return {fs_item_t*} 返回文件或目录对象。
*/
fs_item_t* fs_item_create(void);

/**
* @method fs_item_destroy
*
* 销毁文件或目录对象。
*
* @param {fs_item_t*} item 文件或目录对象。
*
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
*/
ret_t fs_item_destroy(fs_item_t* item);

struct _fs_dir_t;
typedef struct _fs_dir_t fs_dir_t;

Expand Down Expand Up @@ -844,4 +880,4 @@ ret_t fs_test_dir(fs_t* fs);

END_C_DECLS

#endif /*TK_FS_H*/
#endif /*TK_FS_H*/
22 changes: 12 additions & 10 deletions project/gui/awtk/src/tkc/str.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* File: str.c
* Author: AWTK Develop Team
* Brief: string
Expand Down Expand Up @@ -985,39 +985,41 @@ ret_t str_append_json_bool_pair(str_t* str, const char* key, bool_t value) {
return RET_OK;
}

ret_t str_encode_hex(str_t* str, const uint8_t* data, uint32_t size, const char* format) {
ret_t str_encode_hex(str_t* str, const void* data, uint32_t size, const char* format) {
char tstr[64];
uint32_t i = 0;
const uint8_t* p = data;
return_value_if_fail(str != NULL && data != NULL, RET_BAD_PARAMS);

if (format == NULL) {
format = "%02x";
}

for (i = 0; i < size; i++) {
tk_snprintf(tstr, sizeof(tstr) - 1, format, data[i]);
tk_snprintf(tstr, sizeof(tstr) - 1, format, p[i]);
return_value_if_fail(str_append(str, tstr) == RET_OK, RET_OOM);
}

return RET_OK;
}

ret_t str_decode_hex(str_t* str, uint8_t* data, uint32_t size) {
ret_t str_decode_hex(str_t* str, void* data, uint32_t size) {
char* p = NULL;
char v[3] = {0, 0, 0};
uint8_t* d = data;
uint8_t* dend = data + size;
char* p;
char v[3];
return_value_if_fail(str != NULL && data != NULL, RET_BAD_PARAMS);

for (p = str->str; p < str->str + str->size && data < dend; p += 2) {
for (p = str->str; p < str->str + str->size && d < dend; p += 2) {
while (p[0] == ' ') {
p++;
}
if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
p += 2;
}
tk_strncpy(v, p, 2);
*data = tk_strtol(v, 0, 16);
data++;
*d = tk_strtol(v, 0, 16);
d++;
}

return RET_OK;
Expand Down Expand Up @@ -1092,4 +1094,4 @@ ret_t str_append_format(str_t* str, uint32_t size, const char* format, ...) {
str->size += ret;

return RET_OK;
}
}
Loading

0 comments on commit 5524c4b

Please sign in to comment.