【printf】CubeMX生成MDK工程实现printf功能注意点

重定向printf

int fputc(int ch, FILE *f)
{
    /* Write a character to the USART */
    USART1->DR = ch;
    /* Loop until the end of transmission */
    while ((USART1->SR & UART_IT_TC) == RESET);
    return ch;
}

MDK必须选择 MicroLIB

posted @ 2022-07-31 23:43  壹点灵异  阅读(51)  评论(0编辑  收藏  举报