Skip to content

Commit

Permalink
atsamd21: unmask TC4 interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeborges committed Nov 11, 2024
1 parent 03ace97 commit 75c9f66
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rtic-monotonics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ imxrt_gpt2 = ["imxrt"]
esp32c3-systimer = ["dep:esp32c3", "dep:riscv"]

# ATSAMD21 Timer
atsamd21g = ["dep:atsamd21g"]
atsamd21g = ["dep:cortex-m", "dep:atsamd21g"]


# STM32 timers
Expand Down
5 changes: 5 additions & 0 deletions rtic-monotonics/src/atsamd21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ impl Tc4Tc5Backend {
// Enable the timer
tc4.ctrla().modify(|_, w| w.enable().set_bit());
Self::sync();

unsafe {
crate::set_monotonic_prio(pac::NVIC_PRIO_BITS, pac::Interrupt::TC4);
pac::NVIC::unmask(pac::Interrupt::TC4);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions rtic-monotonics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ pub(crate) const fn cortex_logical2hw(logical: u8, nvic_prio_bits: u8) -> u8 {
feature = "nrf5340-net",
feature = "nrf9160",
feature = "imxrt",
feature = "atsamd21g",
stm32,
))]
pub(crate) unsafe fn set_monotonic_prio(
Expand Down

0 comments on commit 75c9f66

Please sign in to comment.