aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/nvic.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple/nvic.c')
-rw-r--r--libmaple/nvic.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libmaple/nvic.c b/libmaple/nvic.c
index 56b9940..60e7eac 100644
--- a/libmaple/nvic.c
+++ b/libmaple/nvic.c
@@ -44,8 +44,10 @@ void nvic_set_vector_table(uint32 addr, uint32 offset) {
void nvic_irq_enable(uint32 n) {
if (n < 32) {
REG_SET_BIT(NVIC_ISER0, n);
- } else {
+ } else if(n < 64) {
REG_SET_BIT(NVIC_ISER1, n - 32);
+ } else {
+ REG_SET_BIT(NVIC_ISER2, n - 64);
}
}
@@ -56,12 +58,19 @@ void nvic_irq_enable(uint32 n) {
void nvic_irq_disable(uint32 n) {
if (n < 32) {
REG_SET_BIT(NVIC_ICER0, n);
- } else {
+ } else if(n < 64) {
REG_SET_BIT(NVIC_ICER1, n - 32);
+ } else {
+ REG_SET_BIT(NVIC_ICER2, n - 64);
}
}
-
+void nvic_irq_disable_all(void) {
+ short n;
+ for(n=0; n<65; n++) {
+ nvic_irq_disable(n);
+ }
+}
/**
* @brief Initialice the NVIC at address addr