286|0

70

帖子

1

TA的资源

一粒金砂(中级)

楼主
 

【Follow me第二季第3期】进阶任务:示例程序中新增命令打印信息 [复制链接]

 

 本次任务是进阶任务:示例程序中新增命令打印信息。

 在memu_main.c中修改s_menu_items菜单数组。添加,Hello Information,对应函数为hello_display_menu。

  • /* Table of menu functions */
  • static st_menu_fn_tbl_t s_menu_items[] =
  • {
  • {"Hello Information" , hello_display_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 }
  • };

然后//memu_kis.c文件中新增以下代码

  • //memu_kis.c
  • #define HELLO_OPTIONS "\r\n\x1b[2m\x1b[37m a) FollowMe 2-3 " \
  • "\r\n\x1b[2m\x1b[37m a) Kit name: %s " \
  • "\r\n\x1b[2m\x1b[37m b) Kit ordering part number: %s " \
  • "\r\n\x1b[2m\x1b[37m c) RA Device part number: %s" \
  • "\r\n\x1b[2m\x1b[37m d) RA MCU 128-bit Unique ID (hex): " \
  • "\x1b[32m%08x\x1b[37m-\x1b[32m%08x\x1b[37m-\x1b[32m%08x\x1b[37m-\x1b[32m%08x\x1b[37m" \
  • "\r\n\x1b[2m\x1b[37m e) RA MCU Die temperature (F/C): \x1b[32m%d.%02d/%d.%02d\x1b[37m " \
  • "\r\n\x1b[2m\x1b[37m f) Blue LED blinking frequency (Hz): \x1b[32m%d\x1b[37m " \
  • "\r\n\x1b[2m\x1b[37m g) Blue LED blinking intensity (%%%%): \x1b[32m%d\x1b[37m "
  • //memu_kis.c
  • test_fn hello_display_menu(void)
  • {
  • int8_t c = -1;
  • uint16_t wn_mcu_temp_f = 0;
  • uint16_t fr_mcu_temp_f = 0;
  • uint16_t wn_mcu_temp_c = 0;
  • uint16_t fr_mcu_temp_c = 0;
  • 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);
  • sprintf (s_print_buffer, "Eeworld and Dgikey is very good", g_selected_menu);
  • /* ignoring -Wpointer-sign is OK when treating signed char_t array as as unsigned */
  • print_to_console((void*)s_print_buffer);
  • wn_mcu_temp_f = g_board_status.temperature_f.whole_number;
  • fr_mcu_temp_f = g_board_status.temperature_f.mantissa;
  • wn_mcu_temp_c = g_board_status.temperature_c.whole_number;
  • fr_mcu_temp_c = g_board_status.temperature_c.mantissa;
  • sprintf (s_print_buffer, HELLO_OPTIONS, FULL_NAME, PART_NUMBER, DEVICE_NUMBER,
  • (int_t)p_uid->unique_id_words[0], (int_t)p_uid->unique_id_words[1], // typedef uint_t in stdint.h
  • (int_t)p_uid->unique_id_words[2], (int_t)p_uid->unique_id_words[3], // as signed long long int64_t;
  • wn_mcu_temp_f, fr_mcu_temp_f, wn_mcu_temp_c, fr_mcu_temp_c,
  • g_pwm_rates_data[g_board_status.led_frequency], g_pwm_dcs_data[g_board_status.led_intensity]);
  • /* 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, MENU_RETURN_INFO);
  • /* 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);
  • }

编译,下载运行。

可以看到,新增的Eeworld and Dgikey is very good和fellow Me 2-3字样,新增命令成功。

点赞 关注
个人签名

人生苦短,我用Python

 
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
推荐帖子
基于QQ2440 WINCE操作系统的GPS模块测试应用

好久木有来写东西了。。。。。从去年年底到现在。。。。我基本上都只在干两件事。。。。搞WINCE。。。。找新工作。。。。 熟悉 ...

有关环境搭建的一个小细节

拿到板子接近一个月了,可惜由于好多其他的事一直未能用那个板子做什么,都是一直看着OS的API感觉看懂了,但是过几天又没有什么 ...

TI Code Composer Studio (CCS) v4.x中文应用指南-软件、安装、注册、教程、示例全集

TI开发软件Code Composer Studio IDE v4 Code Composer Studio IDE v4的主要特性与优势: Code Composer Studio包含一整 ...

有惊喜:遇到Labview疑难杂症,没人理?来这里试试

一顿拖拉拽的操作,分分钟完成个上位机界面,应该是很多人对LabVIEW这款图形化编程软件的印象。好用,但有时候也会遇到一些问题 ...

请问一下 韦伯Wb 和 特斯拉 T 用基本单位制表示是什么?

请问一下 韦伯Wb 和 特斯拉 T 用基本单位制表示是什么?

31“万里”树莓派小车——Ubuntu MATE系统安装

接下来准备开始ROS的学习,可是在Raspberry Pi操作系统上安装尤其困难,在32位buster操作系统上有途径安装ROS,我尝试了很久 ...

嵌入式Qt-实现两个窗口的切换

之前的文章,分别有介绍过使用Qt程序实现一个时钟和一个秒表,本篇,来将这两个功能整合在一起,实现两个页面的随意切换, ...

请教驱动MOS的电路

下面是驱动MOS的电路,有点看不明白 按电路原理,Vl和Vh分别是用来连接低端和高端的电源的,两个电压可以是相同的,但是Vl不 ...

啊~好穷酸啊~年会还不够丢人

话说,你们的年会都怎么样呢? 我司昨天40分钟食堂抽奖 礼物是几十个经理自己准备的,说是大于200,但是都是经理自掏腰包。 ...

有奖直播|完美替代传统汽车钥匙?探索英飞凌数字钥匙解决方案 进行中!

>>点击进入直播 直播时间: 2023年8月31日上午10:00-11:30 直播主题: 完美替代传统汽车钥匙?探索英飞凌 ...

关闭
站长推荐上一条 1/10 下一条
直播报名最后1周:艾迈斯欧司朗 OSP 开放协议,从氛围灯动态照明到传感器交互融合
直播时间:4月22日(周二)10:00
直播奖励:京东卡、蓝牙温湿度计、定制水杯

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网 12

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表