We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f24daad commit c4ab63eCopy full SHA for c4ab63e
rust-app/zephyr/src/uart.rs
@@ -6,7 +6,7 @@ pub trait UartSyscalls {
6
7
fn uart_poll_in(device: &Device) -> Result<Option<char>, u32>;
8
9
- fn uart_err_check(device: &Device) -> i32;
+ fn uart_err_check(device: &Device) -> Option<u32>;
10
11
fn uart_config_get(device: &Device) -> Result<UartConfig, u32>;
12
@@ -47,10 +47,16 @@ macro_rules! trait_impl {
47
}
48
49
#[inline(always)]
50
- fn uart_err_check(device: &Device) -> i32 {
51
- (unsafe {
+ fn uart_err_check(device: &Device) -> Option<u32> {
+ let rc = unsafe {
52
zephyr_sys::syscalls::$context::uart_err_check(device as *const _ as *mut _)
53
- })
+ }
54
+ .neg_err();
55
+
56
+ match rc {
57
+ Ok(_) => None,
58
+ Err(e) => Some(e),
59
60
61
62
0 commit comments