【Follow me第二季第3期】进阶任务:示例程序中新增命令打印信息
[复制链接]
本帖最后由 Juggernaut 于 2024-12-18 22:15 编辑
进阶任务:示例程序中新增命令打印信息
找到s_menu_items[]数组,该数组主要用于路由菜单内容,添加测试内容:
/* Table of menu functions */
static st_menu_fn_tbl_t s_menu_items[] =
{
{"Follow me 3" , kis_follow_menu},
{"Kit Information" , kis_display_menu},
{"Web Server" , eth_emb_display_menu},
{"Network Name Lookup" , eth_www_display_menu},
{"Quad-SPI and Octo-SPI Speed Comparison" , ext_display_menu},
{"Cryptography and USB High speed (MSC)" , enc_display_menu},
{"Next Steps", ns_display_menu },
{"", NULL }
};
加上打印函数kis_follow_menu实现:
/**********************************************************************************************************************
* Function Name: kis_follow_menu
* Description : .
* Return Value : The Kit test demo screen
*********************************************************************************************************************/
test_fn kis_follow_menu(void)
{
int8_t c = -1;
bsp_unique_id_t const * p_uid = R_BSP_UniqueIdGet ();
sprintf (s_print_buffer, "%s%s", gp_clear_screen, gp_cursor_home);
/* ignoring -Wpointer-sign is OK when treating signed char_t array as as unsigned */
print_to_console((void*)s_print_buffer);
sprintf (s_print_buffer, MODULE_NAME, g_selected_menu);
/* ignoring -Wpointer-sign is OK when treating signed char_t array as as unsigned */
print_to_console((void*)s_print_buffer);
/* provide small delay so board_status should be up to date */
vTaskDelay (s_ticks_to_wait);
xEventGroupSetBits (g_update_console_event, STATUS_DISPLAY_MENU_KIS);
while (CONNECTION_ABORT_CRTL != c)
{
c = input_from_console ();
if ((MENU_EXIT_CRTL == c) || (CONNECTION_ABORT_CRTL == c))
{
break;
}
}
xEventGroupClearBits (g_update_console_event, STATUS_DISPLAY_MENU_KIS);
return (0);
}
编译好下载到板子。
1按下去后,因为直接用了KIT INFORMATION的“MODULE_NAME”,故显示“KIT INFORMATION”
也可以修改MODULE_NAME内容,或者在s_print_buffer加入其它要显示的内容。
完成。
|