mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-13 15:16:48 +00:00
uart增加发送字符串的功能
This commit is contained in:
parent
de3324ed7d
commit
8325799657
@ -86,3 +86,22 @@ uchar uart_read(uint32_t port)
|
|||||||
|
|
||||||
return io_in8(port);
|
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;
|
||||||
|
}
|
||||||
|
}
|
@ -62,3 +62,11 @@ void uart_send(uint32_t port, char c);
|
|||||||
* @return uchar 接收到的数据
|
* @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);
|
Loading…
x
Reference in New Issue
Block a user