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

UART: Add wrapper around RIOT's UART-interface #39

Closed
wants to merge 43 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9722813
Added uart
kbarning Feb 1, 2023
5ace203
Fixed callback
kbarning Feb 1, 2023
530e441
Fix code according to @jaschman
kbarning Feb 6, 2023
14f0d08
Add init pins
kbarning Feb 6, 2023
3d7b15b
Fix comments
kbarning Feb 6, 2023
5fb2e12
Fixed signature
kbarning Feb 8, 2023
e1dd2c0
Fixed closure type
kbarning Feb 8, 2023
ac0d680
Mark init pins as unsafe
kbarning Feb 8, 2023
a39a7a7
Fix comments
kbarning Feb 8, 2023
1a0d07c
Change drop
kbarning Feb 8, 2023
b62e14e
Introduce Phantom Data Lifetimes
kbarning Feb 9, 2023
788d633
Add generics to rxstart
kbarning Feb 9, 2023
7e2badb
Add mode feature
kbarning Feb 9, 2023
eec16de
PWM: Add wrapper around RIOTs PWM-interface
Remmirad Feb 8, 2023
398cf41
Removed wrong libs
kbarning Feb 9, 2023
77290d9
Delete pwm.rs
kbarning Feb 9, 2023
2adc6ac
Removed unused comments
kbarning Feb 10, 2023
a3ee384
Update uart.rs
kbarning Feb 10, 2023
6ca86f3
Fixed issues as suggested by chrysn
kbarning Feb 15, 2023
2942733
Added new macro to init uart
kbarning Feb 19, 2023
bf83576
Fix comments
kbarning Feb 19, 2023
06ba80e
Added scoped approach
kbarning Feb 19, 2023
2788caa
Add static new
kbarning Feb 19, 2023
a545c7b
Added new static impl + fix doc
kbarning Feb 19, 2023
e0e99a6
Make get gpio optional
kbarning Feb 27, 2023
820b42c
Remove colission detection for now
kbarning Feb 27, 2023
74e68fd
Add new scoped main
kbarning Mar 17, 2023
be20cea
Update src/uart.rs
kbarning Mar 21, 2023
3a9e145
Update src/uart.rs
kbarning Mar 21, 2023
d957c9f
Update src/uart.rs
kbarning Mar 21, 2023
e45c297
Update src/uart.rs
kbarning Mar 21, 2023
7aa931b
Update src/uart.rs
kbarning Mar 21, 2023
762a639
Make internal construct fn unsafe
kbarning Mar 21, 2023
748fe93
add test
kbarning Mar 21, 2023
cd066aa
Fix scope signature and add cfg to unused structs
kbarning Mar 21, 2023
12fda60
Reordering
kbarning Mar 21, 2023
973d70a
Cleanup
kbarning Mar 21, 2023
59f3d78
Update tests/uart/Cargo.toml
kbarning Dec 7, 2024
03595f9
Update src/uart.rs
kbarning Dec 7, 2024
9763bf3
Update src/uart.rs
kbarning Dec 7, 2024
2b63e71
Update tests/uart/Cargo.toml
kbarning Dec 7, 2024
455291e
Add println to examples, remove unused code
kbarning Dec 7, 2024
16a67e9
Fix rebase
kbarning Dec 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reordering
kbarning committed Dec 7, 2024
commit 12fda60e5e2ad24dfe8e356e7a96f828db06925b
24 changes: 12 additions & 12 deletions src/uart.rs
Original file line number Diff line number Diff line change
@@ -333,18 +333,6 @@ impl UartDevice {
}
}

impl Drop for UartDevice {
/// The `drop` method resets the `UART`, removes the interrupt and tries
/// to reset the `GPIO` pins if possible
fn drop(&mut self) {
unsafe {
uart_init(self.dev, 9600, None, ptr::null_mut());
#[cfg(riot_module_periph_uart_reconfigure)]
self.deinit_pins();
}
}
}

impl UartDevice {
/// Tries to initialize the given `UART` with a static callback. Returns a Result with rather `Ok<Self>` if the UART
/// was initialized successfully or a `Err<UartDeviceStatus>` containing the error
@@ -376,3 +364,15 @@ impl UartDevice {
unsafe { Self::construct_uart(index, baud, user_callback) }
}
}

impl Drop for UartDevice {
/// The `drop` method resets the `UART`, removes the interrupt and tries
/// to reset the `GPIO` pins if possible
fn drop(&mut self) {
unsafe {
uart_init(self.dev, 9600, None, ptr::null_mut());
#[cfg(riot_module_periph_uart_reconfigure)]
self.deinit_pins();
}
}
}