Ejemplo n.º 1
0
// Timer 17 update and capture compare interrupt
void TIM1_TRG_COM_TIM17_IRQHandler(void)
{
  if(__HAL_TIM_GET_FLAG(&TimHandle[0], TIM_FLAG_CC1) != RESET)
  {
    if(__HAL_TIM_GET_ITSTATUS(&TimHandle[0], TIM_IT_CC1) !=RESET)
    {
      {
        __HAL_TIM_CLEAR_IT(&TimHandle[0], TIM_IT_CC1);
        
        encoderSpeed[0] = HAL_TIM_ReadCapturedValue(&TimHandle[0], TIM_CHANNEL_1);
        
        TIM17->CNT = 0;
      }
    }
  }
  
  if(__HAL_TIM_GET_FLAG(&TimHandle[0], TIM_FLAG_UPDATE) != RESET)
  {
    if(__HAL_TIM_GET_ITSTATUS(&TimHandle[0], TIM_IT_UPDATE) !=RESET)
    { 
      __HAL_TIM_CLEAR_IT(&TimHandle[0], TIM_IT_UPDATE);

      encoderSpeed[0] = PERIOD;    // If timer expires we have got no pulse during measurment period, set max time
    }
  }
}
Ejemplo n.º 2
0
// ----- TIM_IRQHandler() ----------------------------------------------------
extern "C" void TIM3_IRQHandler(void) {
	if (__HAL_TIM_GET_ITSTATUS(&imu10DOF.TimHandle, TIM_IT_UPDATE ) != RESET) {
		semaphore_timerInterrupt = 1;
		imu10DOF.timerAction();
		semaphore_timerInterrupt = 0;
		__HAL_TIM_CLEAR_IT(&imu10DOF.TimHandle, TIM_IT_UPDATE);
	}
}
Ejemplo n.º 3
0
void TIM6_DAC_IRQHandler(void)
{
    if (__HAL_TIM_GET_FLAG(&handleTIM6forTimer, TIM_FLAG_UPDATE) == SET && __HAL_TIM_GET_ITSTATUS(&handleTIM6forTimer, TIM_IT_UPDATE))
    {
        Timer_Update1ms();
        __HAL_TIM_CLEAR_FLAG(&handleTIM6forTimer, TIM_FLAG_UPDATE);
        __HAL_TIM_CLEAR_IT(&handleTIM6forTimer, TIM_IT_UPDATE);
    }
}
void TIM8_TRG_COM_TIM14_IRQHandler(void) {
  {
    auto& h = Private::get_timer_cube_handle<14>();
    if(__HAL_TIM_GET_ITSTATUS(&h, TIM_IT_UPDATE) == SET) {
      if(Private::get_timer_irq_handler<14>()) Private::get_timer_irq_handler<14>()();
      __HAL_TIM_CLEAR_IT(&h, TIM_IT_UPDATE);
    }
  }
}
Ejemplo n.º 5
0
void TIM3_IRQHandler(void)
{
    if (__HAL_TIM_GET_FLAG(&TIM_Handle, TIM_FLAG_UPDATE) != RESET)      //In case other interrupts are also running
    {
        if (__HAL_TIM_GET_ITSTATUS(&TIM_Handle, TIM_IT_UPDATE) != RESET)
        {
            __HAL_TIM_CLEAR_FLAG(&TIM_Handle, TIM_FLAG_UPDATE);
            LED_update();
        }
    }
}
Ejemplo n.º 6
0
// Timer 1 Update interrupt
void TIM1_UP_TIM16_IRQHandler(void)
{
  if(__HAL_TIM_GET_FLAG(&TimHandle[1], TIM_FLAG_UPDATE) != RESET)
  {
    if(__HAL_TIM_GET_ITSTATUS(&TimHandle[1], TIM_IT_UPDATE) !=RESET)
    { 
      __HAL_TIM_CLEAR_IT(&TimHandle[1], TIM_IT_UPDATE);

      encoderSpeed[1] = PERIOD;    // If timer expires we have got no pulse during measurment period, set max time
    }
  }
}
Ejemplo n.º 7
0
void TIM4_IRQHandler(void)
{
    if (__HAL_TIM_GET_FLAG(&TIM_Handle2, TIM_FLAG_UPDATE) != RESET)      //In case other interrupts are also running
    {
        if (__HAL_TIM_GET_ITSTATUS(&TIM_Handle2, TIM_IT_UPDATE) != RESET)
        {
            __HAL_TIM_CLEAR_FLAG(&TIM_Handle2, TIM_FLAG_UPDATE);

						osSignalSet(temperature_thread_id, TEMP_DATA_READY_SIGNAL);

        }
    }
}
Ejemplo n.º 8
0
void TIM4_IRQHandler(void)
{
    if (__HAL_TIM_GET_FLAG(&handleTimer4, TIM_FLAG_UPDATE) != RESET)      //In case other interrupts are also running
    {
        if (__HAL_TIM_GET_ITSTATUS(&handleTimer4, TIM_IT_UPDATE) != RESET)
        {
            __HAL_TIM_CLEAR_FLAG(&handleTimer4, TIM_FLAG_UPDATE);

            static int tmp = 0;
            tmp++;
        }
    }
}
Ejemplo n.º 9
0
void timer_irq_handler(void) {
    // Channel 1 for mbed timeout
    if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC1) == SET) {
        __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
        us_ticker_irq_handler();
    }

    // Channel 2 for HAL tick
    if (__HAL_TIM_GET_ITSTATUS(&TimMasterHandle, TIM_IT_CC2) == SET) {
        __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC2);
        uint32_t val = __HAL_TIM_GetCounter(&TimMasterHandle);
        if ((val - PreviousVal) >= HAL_TICK_DELAY) {
            // Increment HAL variable
            HAL_IncTick();
            // Prepare next interrupt
            __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_2, val + HAL_TICK_DELAY);
            PreviousVal = val;
#if 0 // For DEBUG only
            HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_6);
#endif
        }
    }
}
Ejemplo n.º 10
0
// Timer 1 capture compare interrupt
void TIM1_CC_IRQHandler(void)
{
  if(__HAL_TIM_GET_FLAG(&TimHandle[1], TIM_FLAG_CC2) != RESET)
  {
    if(__HAL_TIM_GET_ITSTATUS(&TimHandle[1], TIM_IT_CC2) !=RESET)
    {
      {
        __HAL_TIM_CLEAR_IT(&TimHandle[1], TIM_IT_CC2);
        
        encoderSpeed[1] = HAL_TIM_ReadCapturedValue(&TimHandle[1], TIM_CHANNEL_2);
        
        TIM1->CNT = 0;
      }
    }
  }
}
static void tim_irq_handler(void)
{
  TIM_HandleTypeDef *htim;

  for (hacs_timer_t index = 0; index < HACS_NUM_TIMER_PERIPH; index++) {
    htim = &tim_handles[index];

    // Only care about update event. Code copied from stm32f4xx_tim.c
    if(__HAL_TIM_GET_FLAG(htim, TIM_FLAG_UPDATE) != RESET)
    {
      if(__HAL_TIM_GET_ITSTATUS(htim, TIM_IT_UPDATE) !=RESET)
      {
        __HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);
        if (tim_overflow_cb[index] != NULL) tim_overflow_cb[index]();
      }
    }
  }
}
Ejemplo n.º 12
0
void TIM_IRQH(void){
	#if MEAS_ENABLED
	static volatile uint32_t PerformaceTimer = MEAS_PERIOD;
	#endif

	//If update interrupt is pending and update interrupt is enabled, clear update int flag, increment tick variable and if needed calculate cpu usage
	if( ( __HAL_TIM_GET_FLAG(&Tmr, TIM_FLAG_UPDATE) != RESET ) && ( __HAL_TIM_GET_ITSTATUS(&Tmr, TIM_IT_UPDATE) !=RESET ) ){
		__HAL_TIM_CLEAR_IT(&Tmr, TIM_IT_UPDATE);
		Tick++;

		#if MEAS_ENABLED
		if( PerformaceTimer-- <= 0 ){
			PerformaceTimer = MEAS_PERIOD;
			Perf.CpuLoadVal = PerformanceCounter;
			Perf.CPULoad = 1 - (float)PerformanceCounter/(float)NOLOAD_PERF;
			PerformanceCounter = 0;
		}
		#endif
	}
}