Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch uart #99

Merged
merged 11 commits into from
Dec 6, 2022
Merged

Patch uart #99

merged 11 commits into from
Dec 6, 2022

Conversation

TingSHub
Copy link
Contributor

@TingSHub TingSHub commented Dec 6, 2022

#99使用rust重写串口驱动

@@ -0,0 +1 @@
pub mod uart;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件末尾要新增一行

@@ -0,0 +1 @@
pub mod uart;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件末尾要新增一行

#define UART_SUCCESS 0
#define E_UART_BITS_RATE_ERROR 1
#define E_UART_SERIAL_FAULT 2
enum uart_port_io_addr
Copy link
Member

@fslongjin fslongjin Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议仍保留原来的这个enum

/// baud_rate error: "uart init."
/// device falty: "uart faulty."
#[allow(dead_code)]
pub fn uart_init(uart_port: &UartPort, baud_rate: u32) -> Result<(), &'static str> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

成功时返回i32
也就是Ok(0)

#[allow(dead_code)]
pub fn uart_init(uart_port: &UartPort, baud_rate: u32) -> Result<(), &'static str> {
let message: &'static str = "uart init.";
let port = UartPort::to_u16(&uart_port);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以直接uart_port.to_u16

@fslongjin fslongjin merged commit f8b55f6 into DragonOS-Community:master Dec 6, 2022
@TingSHub TingSHub deleted the patch-uart branch April 26, 2023 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants