File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff 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" );
You can’t perform that action at this time.
0 commit comments