/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file timer.c * @brief This file provides code for the configuration * of the Periodic Timer , PWM and Input Capture. * @data 1-feb-2024 * @Author Vecmocon Technology ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include <..\Core\Include\ivec_mcal_timer.h> static volatile bool b_TimerInitFlag = 0; /*!< Timer initialization flag */ static volatile bool b_TimerCounterFlag = 0; /*!< Timer Counter flag */ static volatile bool b_PwmInitflag = 0; /*!< PWM initialization flag */ static volatile bool b_Pwmstartflag = 0; /*!< PWM Start flag */ static volatile bool b_InputCaputerflag =0; /*!< Input Capture initialization flag */ static volatile uint32_t g_u32CapturePeriod; /*! g_u32CaptureValue0) { g_u32CapturePeriod = g_u32CaptureValue1 - g_u32CaptureValue0; } else { g_u32CapturePeriod = g_u32LoadValue + g_u32CaptureValue1 - g_u32CaptureValue0; } *f_frequency = (timerCAPTURE_FREQ_i32)/(g_u32CapturePeriod + 1) *10; } /** * @brief Timer call back function * @note f_frequency: get the calculated frequency */ void _prv_timAcallback() { vMCAL_Calcfrequency(&f_frequency); } /** * @brief Timer IRQ handler */ void TIMA0_IRQHandler() { // _prv_timAcallback(); switch( DL_TimerA_getPendingInterrupt(TIMA0) ) { case DL_TIMER_IIDX_ZERO: vMCAL_TimerCallback(); break; default: break; } }