当前位置:网站首页>Printf redirection of serial port under sw4stm32 (SW4)

Printf redirection of serial port under sw4stm32 (SW4)

2022-06-24 23:35:00 mialo163

keil(mdk)

sw4stm32(SW4) 

int __io_putchar(int ch)//for sw4
{
	// Block send a byte ( Wait until the last one is sent , Or wait until the current byte is sent )
	// return ch
	USART_SendData(USART1, (unsigned char) ch);
	while (!(USART1->SR & USART_FLAG_TXE));
	return (ch);
}
int fputc(int ch, FILE *f)//for mdk
{
	USART_SendData(USART1, (unsigned char) ch);
	while (!(USART1->SR & USART_FLAG_TXE));
	return (ch);
}

Reprinted address :https://blog.csdn.net/shentianguo1985/article/details/84561477

 

 

原网站

版权声明
本文为[mialo163]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211119255321.html