Skip to content

Commit 3888d04

Browse files
committed
bugfix irq priority for multiple cores lpc55s66
1 parent 642d7af commit 3888d04

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

targets/chip/lpc55s66/lpc55s66.hpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,25 @@ namespace klib::lpc55s66 {
7676
*
7777
* @tparam Irq
7878
*/
79-
template <irq::arm_vector Irq, uint8_t Priority>
79+
template <irq0::arm_vector Irq, uint8_t Priority>
80+
static void interrupt_priority() {
81+
static_assert(static_cast<uint32_t>(Irq) >= static_cast<uint32_t>(irq::arm_vector::count), "Invalid IRQ given to set priority");
82+
static_assert(Priority < (1U << __NVIC_PRIO_BITS), "Invalid priority given to set priority");
83+
84+
// set the priority
85+
NVIC_SetPriority(
86+
static_cast<IRQn_Type>(
87+
static_cast<uint32_t>(Irq) - static_cast<uint32_t>(irq::arm_vector::count)),
88+
Priority
89+
);
90+
}
91+
92+
/**
93+
* @brief Set the priority of a interrupt
94+
*
95+
* @tparam Irq
96+
*/
97+
template <irq1::arm_vector Irq, uint8_t Priority>
8098
static void interrupt_priority() {
8199
static_assert(static_cast<uint32_t>(Irq) >= static_cast<uint32_t>(irq::arm_vector::count), "Invalid IRQ given to set priority");
82100
static_assert(Priority < (1U << __NVIC_PRIO_BITS), "Invalid priority given to set priority");

0 commit comments

Comments
 (0)