Пример #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
    }
  }
}
Пример #2
0
void timer_irq_handler(void) {
    // Channel 1 for mbed timeout
    if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&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_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&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
            }
        }
    }
}
Пример #3
0
/**
* @brief  This function handles TIM5 interrupt request.
* @param  None
* @retval None
*/
void TIM5_IRQHandler(void)
{
  /* clear interrupt pending flag */
  __HAL_TIM_CLEAR_IT(&htim5, TIM_IT_UPDATE);

  rtimer_clock++;
}
Пример #4
0
void timer_irq_handler(void) {
    uint16_t cnt_val = TIM_MST->CNT;

    TimMasterHandle.Instance = TIM_MST;

    // Clear Update interrupt flag
    if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_UPDATE) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_UPDATE) == SET) {
            __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_UPDATE);
            SlaveCounter++;
        }
    }

    // Channel 1 for mbed timeout
    if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
            __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
            if (oc_rem_part > 0) {
                set_compare(oc_rem_part); // Finish the remaining time left
                oc_rem_part = 0;
            } else {
                if (oc_int_part > 0) {
                    set_compare(0xFFFF);
                    oc_rem_part = cnt_val; // To finish the counter loop the next time
                    oc_int_part--;
                } else {
                    us_ticker_irq_handler();
                }
            }
        }
    }

    // Channel 2 for HAL tick
    if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC2) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&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;
            }
        }
    }
}
Пример #5
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);
	}
}
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);
    }
  }
}
Пример #7
0
void
vMBPortTimersDisable(  )
{
   /* Disable any pending timers. */
			__HAL_TIM_DISABLE(&htim6);
			__HAL_TIM_SetCounter(&htim6,0);
			__HAL_TIM_DISABLE_IT(&htim6,TIM_IT_UPDATE);
			__HAL_TIM_CLEAR_IT(&htim6,TIM_IT_UPDATE);
}
Пример #8
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);
    }
}
Пример #9
0
//void WWDG_IRQHandler( void )
//void PVD_IRQHandler( void )
//void TAMP_STAMP_IRQHandler( void )
//void RTC_WKUP_IRQHandler( void )
//void FLASH_IRQHandler( void )
//void RCC_IRQHandler( void )
//void EXTI0_IRQHandler( void )
//void EXTI1_IRQHandler( void )
//void EXTI2_IRQHandler( void )
//void EXTI3_IRQHandler( void )
//void EXTI4_IRQHandler( void )
//void DMA1_Stream0_IRQHandler( void )
//void DMA1_Stream1_IRQHandler( void )
//void DMA1_Stream2_IRQHandler( void )
//void DMA1_Stream3_IRQHandler( void )
//void DMA1_Stream4_IRQHandler( void )
//void DMA1_Stream5_IRQHandler( void )
//void DMA1_Stream6_IRQHandler( void )
//void ADC_IRQHandler( void )
//void EXTI9_5_IRQHandler( void )
//void TIM1_BRK_TIM9_IRQHandler( void )
//void TIM1_UP_TIM10_IRQHandler( void )
//void TIM1_TRG_COM_TIM11_IRQHandler( void )
//void TIM1_CC_IRQHandler( void )
//void TIM2_IRQHandler( void )
void TIM3_IRQHandler( void )
{
  if (__HAL_TIM_GET_FLAG(hTimAhrs.handle, TIM_FLAG_UPDATE) != RESET) {
    if (__HAL_TIM_GET_IT_SOURCE(hTimAhrs.handle, TIM_IT_UPDATE) != RESET) {
      __HAL_TIM_CLEAR_IT(hTimAhrs.handle, TIM_IT_UPDATE);
      hTimAhrs.EventCallback();
    }
  }
}
Пример #10
0
void
vMBPortTimersEnable(  )
{
  /* Enable the timer with the timeout passed to xMBPortTimersInit( ) */
    /* Enable the timer with the timeout passed to xMBPortTimersInit( ) */
		__HAL_TIM_CLEAR_IT(&htim6,TIM_IT_UPDATE);
		__HAL_TIM_ENABLE_IT(&htim6,TIM_IT_UPDATE);
		__HAL_TIM_SetCounter(&htim6,0);
		__HAL_TIM_ENABLE(&htim6);  
}
Пример #11
0
void TIM6_IRQHandler(void)
{
    if(__HAL_TIM_GET_FLAG(&TIM_ADC_HandleStruct, TIM_FLAG_UPDATE) != RESET){
        if(__HAL_TIM_GET_IT_SOURCE(&TIM_ADC_HandleStruct, TIM_IT_UPDATE) !=RESET){
            __HAL_TIM_CLEAR_IT(&TIM_ADC_HandleStruct, TIM_IT_UPDATE);
            ///时基中断
            drv_StartMeasureTemperatureRaw();
        }
    }
}
Пример #12
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
    }
  }
}
Пример #13
0
void
TCX_IRQHANDLER( void )
{
   //HAL_UART_Transmit(&huart1,  "T", 1, 0xFFFF);
    __HAL_TIM_DISABLE(&htim1);
    __HAL_TIM_CLEAR_IT(&htim1, TIM_IT_UPDATE);
  
#if MB_TIMER_DEBUG == 1
        PIO_Clear( &xTimerDebugPins[0] );
#endif
        ( void )pxMBPortCBTimerExpired(  );
}
Пример #14
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]();
      }
    }
  }
}
Пример #16
0
/* ----------------------- Start implementation -----------------------------*/
BOOL
xMBPortTimersInit( USHORT usTim1Timerout50us )
{
  HAL_UART_Transmit(&huart1, "_TI_" , 4, 0xFFFF);
#if MB_TIMER_DEBUG == 1
    PIO_Configure( xTimerDebugPins, PIO_LISTSIZE( xTimerDebugPins ) );
#endif
    __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE);

    htim1.Init.Period = ( 50 * usTim1Timerout50us );
    //htim1.Init.Period = ( 50 * 1000 );
    HAL_TIM_Base_Init(&htim1);

    HAL_NVIC_ClearPendingIRQ(TIM1_UP_IRQn);
    __HAL_TIM_CLEAR_IT(&htim1, TIM_IT_UPDATE);

    return TRUE;
}
Пример #17
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
	}
}
Пример #18
0
/*General Interrupt handler which handles interrupts for Laser trasnmit and
	writing angles to pan and tilt. The interrupt is set to occur every half
	manchester bit period for the purposes of transmitting manchester using GPIO*/
void s4353096_general_irqhandler(void) {
  TIM_Init.Instance = PANTILT_IR_TIM;
  __HAL_TIM_CLEAR_IT(&TIM_Init, TIM_IT_UPDATE);
	vars->count++;
	if (mode == S4353096_LASER_TRANSMIT) {
		if (vars->bit_count == 0 || vars->bit_count == 1 || vars->bit_count == 11 ||
			vars->bit_count == 12) {
			s4353096_laser_transmit_bit(1);
		} else if (vars->bit_count == 10 || vars->bit_count == 21) {
				s4353096_laser_transmit_bit(0);
		} else if ((vars->bit_count == 22) && (vars->bit_half == 1)) {
			//Stop transmitting and reset values
			HAL_GPIO_WritePin(LASER_WAVE_GEN_1_GPIO_PORT, LASER_WAVE_GEN_1_PIN, 0);
			vars->bit_count = 0;
			vars->encoded_bit_count = -1;
			mode = S4353096_TERMINAL;
		} else {
			if (vars->bit_half == 1) {
				vars->encoded_bit_count++;
				vars->encoded_bit = !!((vars->encoded_char >> vars->encoded_bit_count) & 0x1);
			}
			s4353096_laser_transmit_bit(vars->encoded_bit);
		}
	}
Пример #19
0
void us_ticker_clear_interrupt(void)
{
    __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
}
static void lp_handler(void)
{
    __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
    overflows++;
}