【英飞凌CYW20829测评】-3-串口打印工程

本次使用来验证开发环境是否能够正常工作,软件使用的是: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灯闪烁。至此,开发环境搭建,验证成功。
接下来添加自定义代码:

复制
for (;;)

    {

        /* Check if 'Enter' key was pressed */

        if (cyhal_uart_getc(&cy_retarget_io_uart_obj, &uart_read_value, 1)

             == CY_RSLT_SUCCESS)

        {

            if (uart_read_value == '\r')

            {

                /* Pause LED blinking by stopping the timer */

                if (led_blink_active_flag)

                {

                    cyhal_timer_stop(&led_blink_timer);



                    printf("LED blinking paused \r\n");

                }

                else /* Resume LED blinking by starting the timer */

                {

                    cyhal_timer_start(&led_blink_timer);



                    printf("LED blinking resumed\r\n");

                }



                /* Move cursor to previous line */

                printf("\x1b[1F");



                led_blink_active_flag ^= 1;

            }else  if(uart_read_value == ' '){

                    printf("Hello 21ic, Hello Infineon CYW20829!\r\n");

            }

        }

        /* Check if timer elapsed (interrupt fired) and toggle the LED */

        if (timer_interrupt_flag)

        {

            /* Clear the flag */

            timer_interrupt_flag = false;



            /* Invert the USER LED state */

            cyhal_gpio_toggle(CYBSP_USER_LED);

        }

    }



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


---------------------
作者:南来之风
链接:https://bbs.21ic.com/icview-3390518-1-1.html
来源:21ic.com
此文章已获得原创/原创奖标签,著作权归21ic所有,任何人未经允许禁止转载。 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值