work on interrupt handler calling

interrupts
polymurph 3 years ago
parent 2a5aeb61e8
commit 323ee541ad

@ -26,8 +26,6 @@ extern "C" {
#include "stm32f042x6.h" #include "stm32f042x6.h"
#include <stdint.h> #include <stdint.h>
#include "interrupt.h"
#define PACKAGE_LQFP32 1 #define PACKAGE_LQFP32 1
#define MAX_USART_CHANNEL_COUNT 2 #define MAX_USART_CHANNEL_COUNT 2
@ -316,7 +314,8 @@ typedef enum {
intTypeEND intTypeEND
}intType_t; }intType_t;
intHandler_t intHandlerList[intTypeEND] = NULL; uint32_t intHandlerList[intTypeEND]={
0,0,0,0,0,0,0,0,0,0};
static const uint8_t interruptTypeIndexList[intTypeEND] = static const uint8_t interruptTypeIndexList[intTypeEND] =
{ {

@ -11,7 +11,7 @@ void intInit(
NVIC_SetPriority(interruptTypeIndexList[intType], priority); NVIC_SetPriority(interruptTypeIndexList[intType], priority);
// TODO: add index ceck! // TODO: add index ceck!
intHandlerList[intType] = handler; intHandlerList[intType] = (uint32_t)handler;
} }
void intEnableAll() void intEnableAll()
@ -46,41 +46,51 @@ void TIM2_IRQHandler()
TIM2-> SR &= ~TIM_SR_UIF; TIM2-> SR &= ~TIM_SR_UIF;
//TODO: call handler here //TODO: call handler here
(intHandler_t)(intHandlerList[TIM2_UPDATE])();
} }
if(TIM->SR & TIM_SR_CC1IF) { if(TIM->SR & TIM_SR_CC1IF) {
TIM2-> SR &= ~TIM_SR_CC12IF;
} }
if(TIM->SR & TIM_SR_CC12IF) { if(TIM->SR & TIM_SR_CC12IF) {
TIM2-> SR &= ~TIM_SR_CC12IF;
} }
if(TIM->SR & TIM_SR_CC3IF) { if(TIM->SR & TIM_SR_CC3IF) {
TIM2-> SR &= ~TIM_SR_CC3IF;
} }
if(TIM->SR & TIM_SR_CC4IF) { if(TIM->SR & TIM_SR_CC4IF) {
TIM2-> SR &= ~TIM_SR_CC4IF;
} }
if(TIM->SR & TIM_SR_TIF) { if(TIM->SR & TIM_SR_TIF) {
TIM2-> SR &= ~TIM_SR_TIF;
} }
if(TIM->SR & TIM_SR_CC1OF) { if(TIM->SR & TIM_SR_CC1OF) {
TIM2-> SR &= ~TIM_SR_CC1OF;
} }
if(TIM->SR & TIM_SR_CC2OF) { if(TIM->SR & TIM_SR_CC2OF) {
TIM2-> SR &= ~TIM_SR_CC2OF;
} }
if(TIM->SR & TIM_SR_CC3OF) { if(TIM->SR & TIM_SR_CC3OF) {
TIM2-> SR &= ~TIM_SR_CC3OF;
} }
if(TIM->SR & TIM_SR_CC4OF) { if(TIM->SR & TIM_SR_CC4OF) {
TIM2-> SR &= ~TIM_SR_CC4OF;
} }
} }

@ -0,0 +1,2 @@
#include "interrupt.h"
Loading…
Cancel
Save