diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-03-15 19:21:13 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-15 19:21:13 +0000 |
| commit | d18955a13450257c0a7725130beef44f21217138 (patch) | |
| tree | 5bd060104b7a316cea1870fb4a74503bb8624931 | |
| parent | e145269914227e0af2fc082c3cf490489b8bc979 (diff) | |
| parent | ef12ae6b04fa57371507e4ab49f49cb51c30ee4c (diff) | |
Merge #703
703: fix(rtic-sync): used fully qualified paths in Channel Macro r=korken89 a=Yandrik
Other imports with the name `Channel` (e.g. from Embassy) broke this macro. Now they don't.
Co-authored-by: Yandrik <me@yandrik.dev>
| -rw-r--r-- | rtic-monotonics/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | rtic-monotonics/src/rp2040.rs | 13 | ||||
| -rw-r--r-- | rtic-monotonics/src/systick.rs | 13 | ||||
| -rw-r--r-- | rtic-sync/src/channel.rs | 5 |
4 files changed, 13 insertions, 19 deletions
diff --git a/rtic-monotonics/CHANGELOG.md b/rtic-monotonics/CHANGELOG.md index 89f401f..816bc24 100644 --- a/rtic-monotonics/CHANGELOG.md +++ b/rtic-monotonics/CHANGELOG.md @@ -16,5 +16,6 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top! ### Fixed - Unmask the `rp2040` interrupt +- Use `$crate` and fully qualified paths in macros ## [v1.0.0] - 2023-xx-xx diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs index 93472e6..6aa66ce 100644 --- a/rtic-monotonics/src/rp2040.rs +++ b/rtic-monotonics/src/rp2040.rs @@ -139,22 +139,17 @@ impl embedded_hal_async::delay::DelayUs for Timer { /// Register the Timer interrupt for the monotonic. #[macro_export] macro_rules! make_rp2040_monotonic_handler { - () => { - { + () => {{ #[no_mangle] #[allow(non_snake_case)] unsafe extern "C" fn TIMER_IRQ_0() { - rtic_monotonics::rp2040::Timer::__tq().on_monotonic_interrupt(); + $crate::rp2040::Timer::__tq().on_monotonic_interrupt(); } pub struct Rp2040Token; - unsafe impl rtic_monotonics::InterruptToken<rtic_monotonics::rp2040::Timer> - for Rp2040Token - { - } + unsafe impl $crate::InterruptToken<$crate::rp2040::Timer> for Rp2040Token {} Rp2040Token - } - }; + }}; } diff --git a/rtic-monotonics/src/systick.rs b/rtic-monotonics/src/systick.rs index feefc7e..b228e20 100644 --- a/rtic-monotonics/src/systick.rs +++ b/rtic-monotonics/src/systick.rs @@ -157,22 +157,17 @@ impl embedded_hal_async::delay::DelayUs for Systick { /// Register the Systick interrupt for the monotonic. #[macro_export] macro_rules! make_systick_handler { - () => { - { + () => {{ #[no_mangle] #[allow(non_snake_case)] unsafe extern "C" fn SysTick() { - rtic_monotonics::systick::Systick::__tq().on_monotonic_interrupt(); + $crate::systick::Systick::__tq().on_monotonic_interrupt(); } pub struct SystickToken; - unsafe impl rtic_monotonics::InterruptToken<rtic_monotonics::systick::Systick> - for SystickToken - { - } + unsafe impl $crate::InterruptToken<$crate::systick::Systick> for SystickToken {} SystickToken - } - }; + }}; } diff --git a/rtic-sync/src/channel.rs b/rtic-sync/src/channel.rs index 8a817c8..b7b5a48 100644 --- a/rtic-sync/src/channel.rs +++ b/rtic-sync/src/channel.rs @@ -38,6 +38,7 @@ pub struct Channel<T, const N: usize> { } unsafe impl<T, const N: usize> Send for Channel<T, N> {} + unsafe impl<T, const N: usize> Sync for Channel<T, N> {} struct UnsafeAccess<'a, const N: usize> { @@ -102,7 +103,8 @@ impl<T, const N: usize> Channel<T, N> { #[macro_export] macro_rules! make_channel { ($type:path, $size:expr) => {{ - static mut CHANNEL: Channel<$type, $size> = Channel::new(); + static mut CHANNEL: $crate::channel::Channel<$type, $size> = + $crate::channel::Channel::new(); // SAFETY: This is safe as we hide the static mut from others to access it. // Only this point is where the mutable access happens. @@ -176,6 +178,7 @@ impl LinkPtr { } unsafe impl Send for LinkPtr {} + unsafe impl Sync for LinkPtr {} impl<'a, T, const N: usize> core::fmt::Debug for Sender<'a, T, N> { |
