From fa6d7a961afa0ceedc8b6ac39ccba2a07421acfd Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 8 Oct 2011 22:17:07 +0200 Subject: Add Interrupt::set_priority(). --- interrupt.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/interrupt.h b/interrupt.h index 9468a46..d628cdd 100644 --- a/interrupt.h +++ b/interrupt.h @@ -81,6 +81,14 @@ namespace Interrupt { inline void enable(IRQ n) { NVIC.ISER[n >> 5] = 1 << (n & 0x1f); } + + inline void set_priority(Exception n, uint8_t priority) { + SCB.SHPR[n >> 2] = (priority & 0xf) << ((n & 0x03) * 4); + } + + inline void set_priority(IRQ n, uint8_t priority) { + NVIC.IPR[n] = priority; + } }; template -- cgit v1.2.3