uart增加发送字符串的功能

This commit is contained in:
fslongjin 2022-08-03 14:52:42 +08:00
parent de3324ed7d
commit 8325799657
2 changed files with 29 additions and 2 deletions

View File

@ -83,6 +83,25 @@ uchar uart_read(uint32_t port)
{
while (serial_received(port) == 0)
pause();
return io_in8(port);
}
/**
* @brief
*
* @param port
* @param str
*/
void uart_send_str(uint32_t port, const char *str)
{
if ((unlikely(str == NULL)))
return;
while (1)
{
if (unlikely(*str == '\0'))
return;
uart_send(port, *str);
++str;
}
}

View File

@ -61,4 +61,12 @@ void uart_send(uint32_t port, char c);
* @param port
* @return uchar
*/
uchar uart_read(uint32_t port);
uchar uart_read(uint32_t port);
/**
* @brief
*
* @param port
* @param str
*/
void uart_send_str(uint32_t port, const char *str);