diff options
-rw-r--r-- | libmaple/exti.c | 2 | ||||
-rw-r--r-- | libmaple/nvic.c | 12 | ||||
-rw-r--r-- | wirish/wirish.c | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/libmaple/exti.c b/libmaple/exti.c index e806df9..150dd05 100644 --- a/libmaple/exti.c +++ b/libmaple/exti.c @@ -35,7 +35,7 @@ typedef struct ExtIChannel { uint32 irq_line; } ExtIChannel; -volatile static ExtIChannel exti_channels[] = { +static ExtIChannel exti_channels[] = { { .handler = NULL, .irq_line = NVIC_EXTI0 }, // EXTI0 { .handler = NULL, .irq_line = NVIC_EXTI1 }, // EXTI1 { .handler = NULL, .irq_line = NVIC_EXTI2 }, // EXTI2 diff --git a/libmaple/nvic.c b/libmaple/nvic.c index 155da27..b1da605 100644 --- a/libmaple/nvic.c +++ b/libmaple/nvic.c @@ -39,8 +39,8 @@ void nvic_set_vector_table(uint32 addr, uint32 offset) { * @param n interrupt number */ void nvic_irq_enable(uint32 n) { - /* TODO: test */ - __write(BITBAND_PERI(NVIC_ISER0, n), 1); + uint32 *iser = &((uint32*)NVIC_ISER0)[(n/32)]; + __write(iser, BIT(n % 32)); } /** @@ -48,8 +48,8 @@ void nvic_irq_enable(uint32 n) { * @param n interrupt number */ void nvic_irq_disable(uint32 n) { - /* TODO: test */ - __write(BITBAND_PERI(NVIC_ICER0, n), 1); + uint32 *icer = &((uint32*)NVIC_ICER0)[(n/32)]; + __write(icer, BIT(n % 32)); } void nvic_irq_disable_all(void) { @@ -60,8 +60,8 @@ void nvic_irq_disable_all(void) { 64 interrupts, this suffices. */ /* TODO: fix for connectivity line: __write(NVIC_ICER2,1), requires connectivity line support in libmaple.h */ - __write(NVIC_ICER0, 1); - __write(NVIC_ICER1, 1); + __write(NVIC_ICER0, 0xFFFFFFFF); + __write(NVIC_ICER1, 0xFFFFFFFF); } /** diff --git a/wirish/wirish.c b/wirish/wirish.c index 0abec41..89adc1e 100644 --- a/wirish/wirish.c +++ b/wirish/wirish.c @@ -54,7 +54,7 @@ void init(void) { #if NR_DAC_PINS > 0 dac_init(); #endif - + /* initialize clocks */ rcc_clk_init(RCC_CLKSRC_PLL, RCC_PLLSRC_HSE, RCC_PLLMUL_9); rcc_set_prescaler(RCC_PRESCALER_AHB, RCC_AHB_SYSCLK_DIV_1); |