aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-07-18 23:23:26 -0400
committerbnewbold <bnewbold@robocracy.org>2010-07-18 23:23:26 -0400
commitf23dcac7b9235887b75fb4a04f715693ad99b34f (patch)
tree5c725fbbd0031728a1f0532a8b4c0c3f9e9dd815
parent2262a0d83164058b24733e5bad8e58b199bd5743 (diff)
downloadlibrambutan-f23dcac7b9235887b75fb4a04f715693ad99b34f.tar.gz
librambutan-f23dcac7b9235887b75fb4a04f715693ad99b34f.zip
nvic_disable_interrupt
-rw-r--r--libmaple/nvic.c16
-rw-r--r--libmaple/nvic.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/libmaple/nvic.c b/libmaple/nvic.c
index e540894..d8745a4 100644
--- a/libmaple/nvic.c
+++ b/libmaple/nvic.c
@@ -63,6 +63,22 @@ void nvic_enable_interrupt(uint32 n) {
}
}
+/**
+ * @brief turn off interrupt number n
+ * @param[in] n interrupt number
+ */
+void nvic_disable_interrupt(uint32 n) {
+ if (n >= NVIC_NR_INTERRUPTS) {
+ return;
+ }
+
+ if (n < 32) {
+ REG_SET_BIT(NVIC_ICER0, n);
+ } else {
+ REG_SET_BIT(NVIC_ICER1, n - 32);
+ }
+}
+
/**
diff --git a/libmaple/nvic.h b/libmaple/nvic.h
index a9f32d6..8f18e4d 100644
--- a/libmaple/nvic.h
+++ b/libmaple/nvic.h
@@ -65,6 +65,7 @@ extern "C"{
void nvic_init(void);
void nvic_disable_interrupts(void);
void nvic_enable_interrupt(uint32);
+void nvic_disable_interrupt(uint32);
#ifdef __cplusplus
}