summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-07-02 13:25:57 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-07-02 13:25:57 +0200
commit5033da7f5a7932b69c3e8746145f2304e63e4dc3 (patch)
treecb15481af302a84e024b8cdcb9f0f4975e0bf9e9
parent8e41564e1093873432e95fffb3787f8b78f8f1b5 (diff)
Seperated IRQs and Exceptions. Added Interrupt::enable().
-rw-r--r--interrupt.h32
1 files changed, 22 insertions, 10 deletions
diff --git a/interrupt.h b/interrupt.h
index cfc187d..9468a46 100644
--- a/interrupt.h
+++ b/interrupt.h
@@ -1,16 +1,21 @@
#ifndef INTERRUPT_H
#define INTERRUPT_H
+#include "stm32.h"
+
namespace Interrupt {
- enum Interrupt {
- NMI,
- HardFault,
- MemManage,
- BusFault,
- UsageFault,
- SVCall,
- PendSV,
- SysTick,
+ enum Exception {
+ NMI = 2,
+ HardFault = 3,
+ MemManage = 4,
+ BusFault = 5,
+ UsageFault = 6,
+ SVCall = 11,
+ PendSV = 14,
+ SysTick = 15
+ };
+
+ enum IRQ {
WWDG,
PVD,
TAMPER,
@@ -72,9 +77,16 @@ namespace Interrupt {
DMA2_Channel3,
DMA2_Channel4_5
};
+
+ inline void enable(IRQ n) {
+ NVIC.ISER[n >> 5] = 1 << (n & 0x1f);
+ }
};
-template<Interrupt::Interrupt>
+template<Interrupt::Exception>
+void interrupt();
+
+template<Interrupt::IRQ>
void interrupt();
#endif