[AIROC™ 蓝牙] 【英飞凌CYW20829测评】-3-串口打印工程

[复制链接]
 楼主| 南来之风 发表于 2024-7-19 16:59 | 显示全部楼层 |阅读模式
<
本帖最后由 南来之风 于 2024-7-20 15:50 编辑

本次使用来验证开发环境是否能够正常工作,软件使用的是:Eclipse IDE for ModusToolbox™。




点击New Application后,遇到了如下错误:


ModusToolbox™讲堂 | 第二课 - 中国大陆用户使用须知  https://bbs.21ic.com/icview-3331792-1-1.html
ModusToolbox URL Modifier https://community.infineon.com/t5/Code-Examples/ModusToolbox-URL-Modifier/m-p/366015
几经折腾,非常繁琐。选择开发板



选择一个简单的入门工程:



点击create后,还是有错误,多次尝试。


终于下载好了HELLO world.


Build Project:


编译完成:


运行程序需要点击左下角的Launch Hello World Program.



ENTER键可以控制LED灯闪烁。至此,开发环境搭建,验证成功。
接下来添加自定义代码:
  1. for (;;)
  2.     {
  3.         /* Check if 'Enter' key was pressed */
  4.         if (cyhal_uart_getc(&cy_retarget_io_uart_obj, &uart_read_value, 1)
  5.              == CY_RSLT_SUCCESS)
  6.         {
  7.             if (uart_read_value == '\r')
  8.             {
  9.                 /* Pause LED blinking by stopping the timer */
  10.                 if (led_blink_active_flag)
  11.                 {
  12.                     cyhal_timer_stop(&led_blink_timer);

  13.                     printf("LED blinking paused \r\n");
  14.                 }
  15.                 else /* Resume LED blinking by starting the timer */
  16.                 {
  17.                     cyhal_timer_start(&led_blink_timer);

  18.                     printf("LED blinking resumed\r\n");
  19.                 }

  20.                 /* Move cursor to previous line */
  21.                 printf("\x1b[1F");

  22.                 led_blink_active_flag ^= 1;
  23.             }else  if(uart_read_value == ' '){
  24.                     printf("Hello 21ic, Hello Infineon CYW20829!\r\n");
  25.             }
  26.         }
  27.         /* Check if timer elapsed (interrupt fired) and toggle the LED */
  28.         if (timer_interrupt_flag)
  29.         {
  30.             /* Clear the flag */
  31.             timer_interrupt_flag = false;

  32.             /* Invert the USER LED state */
  33.             cyhal_gpio_toggle(CYBSP_USER_LED);
  34.         }
  35.     }


当ENTER键按下后,控制LED闪烁;当空格键按下后,串口助手显示预定义字符串:







本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

69

主题

290

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部