From 406bb83fca12005df9df265f76fd0a4f3dbde79d Mon Sep 17 00:00:00 2001 From: kerem yollu Date: Fri, 10 Mar 2023 11:27:57 +0100 Subject: [PATCH] Defined new todos, and re-aranged timer2 Interrupt --- CMakeLists.txt | 3 +- README.md | 12 ++++ .../implementation/imp_interrupt.c | 67 ------------------- csl/stm32f042k6t6/implementation/imp_timer.c | 67 ++++++++++++++++++- env/cmake_core/cmakeCore.cmake | 2 +- 5 files changed, 81 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d7ba37..60511b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,9 @@ set(EXECUTABLE ${PROJECT_NAME}) set(CMAKE_VERBOSE_MAKEFILE OFF) # Should CMake print everythign ? -set(OUTPUT_DOXYGEN TRUE) # Should CMake generate Doxygen output ? +set(OUTPUT_DOXYGEN FALSE) # Should CMake generate Doxygen output ? set(DOXYGEN_OUTPUT_DIR ${CMAKE_SOURCE_DIR}/env/doc) + # TODO: discuss on where doxygen should place the output # -> in env/doc # -> in ked_build outside of the ked environment (prefered, as it includes also the users diff --git a/README.md b/README.md index b1e5768..de55b1c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ # KED: Wellcome to Kerem and Edwin's Develeppoment platform. + +# Workflow +##TODO: (In Chronological Form) ++ Implementing interrupt + + Timer Together + + GPIO Together/Alone + + SPI Edwin + + I2C Kerem ++ PWM Inlcuding Interrupts (Edwin &| Kerem) ++ Test KED with Reflow Oven ++ DMA + ## Introduction: ### Why ? This project is made to enable high portability between different Plaftorms an MCU's awailable on the market. diff --git a/csl/stm32f042k6t6/implementation/imp_interrupt.c b/csl/stm32f042k6t6/implementation/imp_interrupt.c index da5ce58..dcda7fa 100644 --- a/csl/stm32f042k6t6/implementation/imp_interrupt.c +++ b/csl/stm32f042k6t6/implementation/imp_interrupt.c @@ -38,70 +38,3 @@ void intDissable( NVIC_DisableIRQ(interruptTypeIndexList[intType]); } -// Interrupt service routines - -void TIM2_IRQHandler() -{ - - if(TIM2->SR & TIM_SR_UIF) { - // clear flag - TIM2-> SR &= ~TIM_SR_UIF; - - //TODO: call handler here - ((intHandler_t)(intHandlerList[TIM2_UPDATE]))(); - } - - if(TIM2->SR & TIM_SR_CC1IF) { - TIM2-> SR &= ~TIM_SR_CC1IF; - - ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_1]))(); - } - - if(TIM2->SR & TIM_SR_CC2IF) { - TIM2-> SR &= ~TIM_SR_CC2IF; - - ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_2]))(); - } - - if(TIM2->SR & TIM_SR_CC3IF) { - TIM2-> SR &= ~TIM_SR_CC3IF; - - ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_3]))(); - } - - if(TIM2->SR & TIM_SR_CC4IF) { - TIM2-> SR &= ~TIM_SR_CC4IF; - - ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_4]))(); - } - - if(TIM2->SR & TIM_SR_TIF) { - TIM2-> SR &= ~TIM_SR_TIF; - - ((intHandler_t)(intHandlerList[TIM2_TRIGGER]))(); - } - - if(TIM2->SR & TIM_SR_CC1OF) { - TIM2-> SR &= ~TIM_SR_CC1OF; - - ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMPARE_1]))(); - } - - if(TIM2->SR & TIM_SR_CC2OF) { - TIM2-> SR &= ~TIM_SR_CC2OF; - - ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMPARE_2]))(); - } - - if(TIM2->SR & TIM_SR_CC3OF) { - TIM2-> SR &= ~TIM_SR_CC3OF; - - ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMPARE_3]))(); - } - - if(TIM2->SR & TIM_SR_CC4OF) { - TIM2-> SR &= ~TIM_SR_CC4OF; - - ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMAPRE_4]))(); - } -} diff --git a/csl/stm32f042k6t6/implementation/imp_timer.c b/csl/stm32f042k6t6/implementation/imp_timer.c index b8e7e0a..f4fa877 100644 --- a/csl/stm32f042k6t6/implementation/imp_timer.c +++ b/csl/stm32f042k6t6/implementation/imp_timer.c @@ -1,5 +1,5 @@ #include "timer.h" - +#include "interrupt.h" #define BASE ((TIM_TypeDef *)timerBase_Addr_List[timer]) @@ -248,3 +248,68 @@ void timerThrowError(timerError_t error) while(1); } +// Interrupt service routines +void TIM2_IRQHandler() +{ + if(TIM2->SR & TIM_SR_UIF) { + // clear flag + TIM2-> SR &= ~TIM_SR_UIF; + + //TODO: call handler here + ((intHandler_t)(intHandlerList[TIM2_UPDATE]))(); + } + + if(TIM2->SR & TIM_SR_CC1IF) { + TIM2-> SR &= ~TIM_SR_CC1IF; + + ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_1]))(); + } + + if(TIM2->SR & TIM_SR_CC2IF) { + TIM2-> SR &= ~TIM_SR_CC2IF; + + ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_2]))(); + } + + if(TIM2->SR & TIM_SR_CC3IF) { + TIM2-> SR &= ~TIM_SR_CC3IF; + + ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_3]))(); + } + + if(TIM2->SR & TIM_SR_CC4IF) { + TIM2-> SR &= ~TIM_SR_CC4IF; + + ((intHandler_t)(intHandlerList[TIM2_COUNTERCOMPARE_4]))(); + } + + if(TIM2->SR & TIM_SR_TIF) { + TIM2-> SR &= ~TIM_SR_TIF; + + ((intHandler_t)(intHandlerList[TIM2_TRIGGER]))(); + } + + if(TIM2->SR & TIM_SR_CC1OF) { + TIM2-> SR &= ~TIM_SR_CC1OF; + + ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMPARE_1]))(); + } + + if(TIM2->SR & TIM_SR_CC2OF) { + TIM2-> SR &= ~TIM_SR_CC2OF; + + ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMPARE_2]))(); + } + + if(TIM2->SR & TIM_SR_CC3OF) { + TIM2-> SR &= ~TIM_SR_CC3OF; + + ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMPARE_3]))(); + } + + if(TIM2->SR & TIM_SR_CC4OF) { + TIM2-> SR &= ~TIM_SR_CC4OF; + + ((intHandler_t)(intHandlerList[TIM2_CAPTURECOMAPRE_4]))(); + } +} diff --git a/env/cmake_core/cmakeCore.cmake b/env/cmake_core/cmakeCore.cmake index 5b0a82d..e01838b 100755 --- a/env/cmake_core/cmakeCore.cmake +++ b/env/cmake_core/cmakeCore.cmake @@ -71,7 +71,7 @@ endfunction() function(makeSubmodules _directory _aliasList _submoduleList) set(_newSubmoduleList) set(_headerLoc) - #For each alias of element present on the list that have been given as argument + #For each alias of element present on the list that has been given as argument foreach(alias IN LISTS _aliasList) checkDirectory("${_directory}/${alias}") # Does the directory exists (If not fatal error)