mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
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>
This commit is contained in:
commit
d18955a134
4 changed files with 13 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
};
|
||||
}};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
};
|
||||
}};
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Reference in a new issue