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>
This commit is contained in:
bors[bot] 2023-03-15 19:21:13 +00:00 committed by GitHub
commit d18955a134
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 19 deletions

View file

@ -16,5 +16,6 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
### Fixed ### Fixed
- Unmask the `rp2040` interrupt - Unmask the `rp2040` interrupt
- Use `$crate` and fully qualified paths in macros
## [v1.0.0] - 2023-xx-xx ## [v1.0.0] - 2023-xx-xx

View file

@ -139,22 +139,17 @@ impl embedded_hal_async::delay::DelayUs for Timer {
/// Register the Timer interrupt for the monotonic. /// Register the Timer interrupt for the monotonic.
#[macro_export] #[macro_export]
macro_rules! make_rp2040_monotonic_handler { macro_rules! make_rp2040_monotonic_handler {
() => { () => {{
{
#[no_mangle] #[no_mangle]
#[allow(non_snake_case)] #[allow(non_snake_case)]
unsafe extern "C" fn TIMER_IRQ_0() { 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; pub struct Rp2040Token;
unsafe impl rtic_monotonics::InterruptToken<rtic_monotonics::rp2040::Timer> unsafe impl $crate::InterruptToken<$crate::rp2040::Timer> for Rp2040Token {}
for Rp2040Token
{
}
Rp2040Token Rp2040Token
} }};
};
} }

View file

@ -157,22 +157,17 @@ impl embedded_hal_async::delay::DelayUs for Systick {
/// Register the Systick interrupt for the monotonic. /// Register the Systick interrupt for the monotonic.
#[macro_export] #[macro_export]
macro_rules! make_systick_handler { macro_rules! make_systick_handler {
() => { () => {{
{
#[no_mangle] #[no_mangle]
#[allow(non_snake_case)] #[allow(non_snake_case)]
unsafe extern "C" fn SysTick() { unsafe extern "C" fn SysTick() {
rtic_monotonics::systick::Systick::__tq().on_monotonic_interrupt(); $crate::systick::Systick::__tq().on_monotonic_interrupt();
} }
pub struct SystickToken; pub struct SystickToken;
unsafe impl rtic_monotonics::InterruptToken<rtic_monotonics::systick::Systick> unsafe impl $crate::InterruptToken<$crate::systick::Systick> for SystickToken {}
for SystickToken
{
}
SystickToken SystickToken
} }};
};
} }

View file

@ -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> Send for Channel<T, N> {}
unsafe impl<T, const N: usize> Sync for Channel<T, N> {} unsafe impl<T, const N: usize> Sync for Channel<T, N> {}
struct UnsafeAccess<'a, const N: usize> { struct UnsafeAccess<'a, const N: usize> {
@ -102,7 +103,8 @@ impl<T, const N: usize> Channel<T, N> {
#[macro_export] #[macro_export]
macro_rules! make_channel { macro_rules! make_channel {
($type:path, $size:expr) => {{ ($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. // SAFETY: This is safe as we hide the static mut from others to access it.
// Only this point is where the mutable access happens. // Only this point is where the mutable access happens.
@ -176,6 +178,7 @@ impl LinkPtr {
} }
unsafe impl Send for LinkPtr {} unsafe impl Send for LinkPtr {}
unsafe impl Sync for LinkPtr {} unsafe impl Sync for LinkPtr {}
impl<'a, T, const N: usize> core::fmt::Debug for Sender<'a, T, N> { impl<'a, T, const N: usize> core::fmt::Debug for Sender<'a, T, N> {