summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-10-08 22:17:07 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-10-08 22:17:07 +0200
commitfa6d7a961afa0ceedc8b6ac39ccba2a07421acfd (patch)
tree2dfe9075400ec904556029e96277c3b3f3df04f4
parentb7762c5a3571b6a0fc311539e8f0ca79038ec4ee (diff)
Add Interrupt::set_priority().
-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>