20250529 同步自原始工程:
优化 CMakeLists.txt,增加 lib-out 目录的包含;修改 app_config.c 中的 LED 灯带开关变量名;更新 app_config.h,增加新的灯效模式和方向控制;更新 SBDEMO.h 中的默认设备名称;在 msc_host.c 中添加 USB 设备连接类型的处理;在 usbport.c 中增加 USB 连接类型的状态管理;更新 Kconfig,增加 LED 灯带的最大图层数和竞速模式选项;新增 spbelib_interface.h 文件,定义无线调参功能接口;删除不再使用的 components/CMakeLists.txt 文件;更新 misc.h,添加读取 MCU 身份信息的 MD5 值的函数声明;修改 tim.h 中的 drv_pwm_init 函数参数;更新 kk.h,增加默认工作队列的创建宏;优化 sh.c 中的命令行插入字符串逻辑;更新 sdkconfig 默认配置文件,升级 ESP-IDF 版本和调整蓝牙默认发射功率。
This commit is contained in:
11
components/system/CMakeLists.txt
Normal file
11
components/system/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
list(APPEND incs "include")
|
||||
|
||||
list(APPEND srcs "source/k_kit/k_kit.c")
|
||||
list(APPEND srcs "source/shell/sh_vt100.c")
|
||||
list(APPEND srcs "source/shell/sh_vset.c")
|
||||
list(APPEND srcs "source/shell/sh.c")
|
||||
|
||||
idf_component_register(
|
||||
INCLUDE_DIRS ${incs}
|
||||
SRCS ${srcs}
|
||||
)
|
||||
@@ -21,6 +21,15 @@ void drv_misc_busy_wait(unsigned us);
|
||||
*/
|
||||
unsigned *drv_misc_bitband(void *mem);
|
||||
|
||||
/**
|
||||
* @brief 读取 MCU 身份信息的 MD5 值
|
||||
*
|
||||
* @param out[out] 输出
|
||||
* @retval 0 成功
|
||||
* @retval -1 失败
|
||||
*/
|
||||
int drv_misc_read_id_md5(unsigned char out[16]);
|
||||
|
||||
/**
|
||||
* @brief 设置中断向量地址
|
||||
*
|
||||
|
||||
@@ -51,7 +51,7 @@ void drv_pwm_pin_configure(hal_id_t id, uint8_t pin);
|
||||
void drv_pwm_enable(hal_id_t id);
|
||||
void drv_pwm_disable(hal_id_t id);
|
||||
|
||||
void drv_pwm_init(hal_id_t id, unsigned period_ns, unsigned reload_enable);
|
||||
void drv_pwm_init(hal_id_t id, unsigned channel_mask, unsigned period_ns, unsigned reload_enable);
|
||||
void drv_pwm_deinit(hal_id_t id);
|
||||
|
||||
int drv_pwm_irq_callback_enable(hal_id_t id, tim_isr_cb_fn cb);
|
||||
|
||||
@@ -40,9 +40,10 @@ typedef k_pipe_t kk_pipe_t;
|
||||
#define kk_work_q_delete() k_work_q_delete(WORK_Q_HDL) // 删除一个工作队列的对象
|
||||
#define kk_work_q_is_valid() k_work_q_is_valid(WORK_Q_HDL) // 获取工作队列是否有效
|
||||
|
||||
#define kk_work_create(work_handle, work_route, arg, priority) k_work_create(work_handle, #work_route, work_route, arg, priority) // 创建由工作队列管理的任务
|
||||
#define kk_work_delete(work_handle) k_work_delete(work_handle) // 删除由工作队列管理的任务
|
||||
#define kk_work_submit(work_q_handle, work_handle, delay) k_work_submit(work_q_handle, work_handle, delay) // 多少时间后唤醒任务
|
||||
#define kk_work_create(work_handle, work_route, arg, priority) k_work_create(work_handle, #work_route, work_route, arg, priority) // 创建由工作队列管理的任务
|
||||
#define kk_work_create_default(work_handle, work_route, arg, priority, delay) k_work_create_default(work_handle, #work_route, work_route, arg, priority, delay) // 创建由工作队列管理的任务,使用默认的工作队列
|
||||
#define kk_work_delete(work_handle) k_work_delete(work_handle) // 删除由工作队列管理的任务
|
||||
#define kk_work_submit(work_q_handle, work_handle, delay) k_work_submit(work_q_handle, work_handle, delay) // 多少时间后唤醒任务
|
||||
|
||||
#define kk_work_is_valid(work_handle) k_work_is_valid(work_handle) // 获取任务对象是否有效
|
||||
#define kk_work_is_pending(work_handle) k_work_is_pending(work_handle) // 获取任务是否在就绪或延时的状态
|
||||
|
||||
@@ -469,43 +469,40 @@ static void _find_and_run_key(sh_t *sh_hdl, char c)
|
||||
*/
|
||||
static void _insert_str(sh_t *sh_hdl, const char *str)
|
||||
{
|
||||
int remain = _SH_ARRAY_COUNT(sh_hdl->cmd_line) - (sh_hdl->cmd_buf - sh_hdl->cmd_line) - sh_hdl->cmd_stored - 1; // -1: 保留 '\0'
|
||||
int len = strlen(str);
|
||||
if (len > remain)
|
||||
{
|
||||
len = remain;
|
||||
}
|
||||
if (len)
|
||||
{
|
||||
int remain = _SH_ARRAY_COUNT(sh_hdl->cmd_line) - (sh_hdl->cmd_buf - sh_hdl->cmd_line) - sh_hdl->cmd_stored - 1;
|
||||
if (len > remain)
|
||||
{
|
||||
len = remain;
|
||||
}
|
||||
_apply_history(sh_hdl);
|
||||
if (sh_hdl->cmd_stored < remain)
|
||||
if (sh_hdl->port.insert_str) /* 设置终端插入一个字符 */
|
||||
{
|
||||
if (sh_hdl->port.insert_str) /* 设置终端插入一个字符 */
|
||||
{
|
||||
sh_hdl->port.insert_str(sh_hdl, str);
|
||||
}
|
||||
sh_hdl->port.insert_str(sh_hdl, str);
|
||||
}
|
||||
|
||||
for (int i = sh_hdl->cmd_stored - 1 + len; i > sh_hdl->cmd_input; i--) /* 使光标之后的数据往后移动 len 个字节 */
|
||||
{
|
||||
sh_hdl->cmd_buf[i] = sh_hdl->cmd_buf[i - len];
|
||||
}
|
||||
for (int i = sh_hdl->cmd_stored - 1 + len; i > sh_hdl->cmd_input; i--) /* 使光标之后的数据往后移动 len 个字节 */
|
||||
{
|
||||
sh_hdl->cmd_buf[i] = sh_hdl->cmd_buf[i - len];
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
sh_hdl->cmd_buf[sh_hdl->cmd_input + i] = str[i];
|
||||
}
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
sh_hdl->cmd_buf[sh_hdl->cmd_input + i] = str[i];
|
||||
}
|
||||
|
||||
sh_hdl->cmd_input += len;
|
||||
sh_hdl->cmd_stored += len;
|
||||
sh_hdl->sync_cursor += len;
|
||||
sh_hdl->cmd_input += len;
|
||||
sh_hdl->cmd_stored += len;
|
||||
sh_hdl->sync_cursor += len;
|
||||
|
||||
sh_hdl->cmd_buf[sh_hdl->cmd_stored] = '\0';
|
||||
sh_hdl->cmd_buf[sh_hdl->cmd_stored] = '\0';
|
||||
|
||||
/* 启用刷新命令行模式 */
|
||||
if (sh_hdl->port.clear_line)
|
||||
{
|
||||
sh_refresh_line(sh_hdl);
|
||||
}
|
||||
/* 启用刷新命令行模式 */
|
||||
if (sh_hdl->port.clear_line)
|
||||
{
|
||||
sh_refresh_line(sh_hdl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -525,7 +522,7 @@ static char *_parse_input(int *argc, const char *argv[], char *dest, const char
|
||||
char *ret = dest;
|
||||
bool end = false;
|
||||
*argc = 0;
|
||||
while (end == false && *argc < CONFIG_SH_MAX_PARAM)
|
||||
while (*src != '\0' && end == false && *argc < CONFIG_SH_MAX_PARAM)
|
||||
{
|
||||
int len = 0;
|
||||
|
||||
@@ -2763,6 +2760,7 @@ void sh_ctrl_print_cmd_line(sh_t *sh_hdl)
|
||||
sh_echo(sh_hdl, line);
|
||||
|
||||
sh_hdl->cmd_input = strlen(line);
|
||||
sh_hdl->cmd_stored = sh_hdl->cmd_input;
|
||||
sh_hdl->sync_cursor = sh_hdl->cmd_input;
|
||||
_update_cursor(sh_hdl);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user