aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
}