打印

有关,阿波罗 429 串口问题

[复制链接]
276|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
串口代码 Uart.c 里,如下代码:刪了 429 系統就有问题,请问这是何代码?


======================================================================================
//加入以下代碼,支持printf函數,而不需要選擇use MicroLIB         
#if 1
#pragma import(__use_no_semihosting)  
//解決HAL庫使用時,某些情況可能報錯的bug
int _ttywrch(int ch)   
{
    ch=ch;
        return ch;
}
//標準庫需要的支持函數                 
struct __FILE
{
        int handle;
        /* Whatever you require here. If the only file you are using is */
        /* standard output using printf() for debugging, no file handling */
        /* is required. */
};
/* FILE is typedef’ d in stdio.h. */
FILE __stdout;      
//定義_sys_exit()以避免使用半主機模式   
void _sys_exit(int x)
{
        x = x;
}
//重定義fputc函數
int fputc(int ch, FILE *f)
{      
        while((USART1->SR&0X40)==0);//循環發送,直到發送完畢   
        USART1->DR = (u8) ch;      
        return ch;
}
#endif
//end
//////////////////////////////////////////////////////////////////

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

384

主题

384

帖子

0

粉丝