UART Transmit and Receive例程的测试,在Application中将该例程编译烧录
然后再串口调试助手进行查看现象。并进行相应的代码修改
- 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;
- }
- }
- /* 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);
- }
- }
- }
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|