summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interrupt.h8
1 files changed, 8 insertions, 0 deletions
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<Interrupt::Exception>