• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ HAL_TIM_ReadCapturedValue函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAL_TIM_ReadCapturedValue函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_TIM_ReadCapturedValue函数的具体用法?C++ HAL_TIM_ReadCapturedValue怎么用?C++ HAL_TIM_ReadCapturedValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAL_TIM_ReadCapturedValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: HAL_TIM_IC_CaptureCallback

/**
  * @brief  Conversion complete callback in non blocking mode 
  * @param  htim: TIM handle
  * @retval None
  */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
  if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2)
  {
    if(uhCaptureIndex == 0)
    {
      /* Get the 1st Input Capture value */
      uwIC2Value1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
      uhCaptureIndex = 1;
    }
    else if(uhCaptureIndex == 1)
    {
      /* Get the 2nd Input Capture value */
      uwIC2Value2 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2); 
      
      /* Capture computation */
      if (uwIC2Value2 > uwIC2Value1)
      {
        uwDiffCapture = (uwIC2Value2 - uwIC2Value1); 
      }
      else  /* (uwIC2Value2 <= uwIC2Value1) */
      {
        uwDiffCapture = ((0xFFFF - uwIC2Value1) + uwIC2Value2); 
      }

      /* Frequency computation: for this example TIMx (TIM1) is clocked by
         2xAPB2Clk */      
      uwFrequency = (2*HAL_RCC_GetPCLK2Freq()) / uwDiffCapture;
      uhCaptureIndex = 0;
    } 
  }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:37,代码来源:main.c


示例2: HAL_TIM_IC_CaptureCallback

/**
  * @brief  Conversion complete callback in non blocking mode 
  * @param  htim : htim handle
  * @retval None
  */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
  if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4)
  {
    if(uhCaptureIndex == 0)
    {
      /* Get the 1st Input Capture value */
      uwIC2Value1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_4);
      uhCaptureIndex = 1;
    }
    else if(uhCaptureIndex == 1)
    {
      /* Get the 2nd Input Capture value */
      uwIC2Value2 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_4); 
      
      /* Capture computation */
      if (uwIC2Value2 > uwIC2Value1)
      {
        uwDiffCapture = (uwIC2Value2 - uwIC2Value1); 
      }
      else if (uwIC2Value2 < uwIC2Value1)
      {
        uwDiffCapture = ((0xFFFF - uwIC2Value1) + uwIC2Value2); 
      }
      else
      {
        uwDiffCapture = 0;
      }
      /* Compute the pulse width in us */
      uwMeasuredPulse = (uint32_t)(((uint64_t) uwDiffCapture * 1000000) / HAL_RCC_GetPCLK1Freq());
      uhCaptureIndex = 0;
    }
    
  }
}
开发者ID:shjere,项目名称:common,代码行数:40,代码来源:main.c


示例3: HAL_TIM_OC_DelayElapsedCallback

/**
  * @brief  Output Compare callback in non blocking mode 
  * @param  htim : TIM OC handle
  * @retval None
  */
void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)
{
  /* TIM3_CH1 toggling with frequency = 195 Hz */
  if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1)
  {
    uhCapture = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
    /* Set the Capture Compare Register value */
    __HAL_TIM_SET_COMPARE(&TimHandle, TIM_CHANNEL_1, (uhCapture + uhCCR1_Val));
  }
  
  /* TIM3_CH2 toggling with frequency = 390 Hz */
  if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2)
  {
    uhCapture = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
    /* Set the Capture Compare Register value */
    __HAL_TIM_SET_COMPARE(&TimHandle, TIM_CHANNEL_2, (uhCapture + uhCCR2_Val));   
  }
  
  /* TIM3_CH3 toggling with frequency = 780 Hz */
  if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3)
  {
    uhCapture = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_3);
    /* Set the Capture Compare Register value */
    __HAL_TIM_SET_COMPARE(&TimHandle, TIM_CHANNEL_3, (uhCapture + uhCCR3_Val));
  }
  
  /* TIM3_CH4 toggling with frequency = 1560 Hz */
  if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4)
  {
    uhCapture = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_4);
    /* Set the Capture Compare Register value */
    __HAL_TIM_SET_COMPARE(&TimHandle, TIM_CHANNEL_4, (uhCapture + uhCCR4_Val));
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF2,代码行数:39,代码来源:main.c


示例4: Get_Speed

/**
  * @brief  获得两次时间间隔中的编码器读数差.
  * @param  None
  * @retval None
  */	
void Get_Speed(void){
  uint32_t TempL,TempR;
    TempL=HAL_TIM_ReadCapturedValue(&TimHandleT9, TIM_CHANNEL_1);//编码器读取
    Speed_L=TempL;
	/*
	Speed_L=TempL-Pre_Speed_L;
    Pre_Speed_L=TempL;  
    if(Speed_L<-20000){
       Speed_L+=65535;}
    else   if(Speed_L>20000){
    Speed_L-=65535;} 
	*/
    TempR=HAL_TIM_ReadCapturedValue(&TimHandleT5, TIM_CHANNEL_1);//编码器读取
		
		Speed_R=TempR;
		/*
    Speed_R=TempR-Pre_Speed_R;
    Pre_Speed_R=TempR;  
    if(Speed_R<-20000){
       Speed_R+=65535;}
    else   if(Speed_R>20000){
    Speed_R-=65535;} 
		//一阶低通滤波
    Speed_A_Last=(Speed_L-Speed_R)/2;
		Speed_A*=0.7;
    Speed_A+=Speed_A_Last*0.3;  
		*/
}
开发者ID:photon0414,项目名称:Balance_Car_STM32,代码行数:33,代码来源:function.c


示例5: HAL_TIM_IC_CaptureCallback

/**
  * @brief  Conversion complete callback in non blocking mode
  * @param  htim: TIM handle
  * @retval None
  */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
	uint16_t captureVal;


	if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {
		captureVal = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
		motorHallTimoutCnt[0] = 0;
		motorHallPeriode[0] = captureVal - motorHallLastCapVal[0];
		motorHallLastCapVal[0] = captureVal;
	}
	if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) {
		captureVal = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
		motorHallTimoutCnt[0] = 0;
		motorHallPeriode[0] = captureVal - motorHallLastCapVal[1];
		motorHallLastCapVal[1] = captureVal;
	}
	if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {
		captureVal = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_3);
		motorHallTimoutCnt[1] = 0;
		motorHallPeriode[1] = captureVal - motorHallLastCapVal[2];
		motorHallLastCapVal[2] = captureVal;
	}
	if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
		captureVal = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_4);
		motorHallTimoutCnt[1] = 0;
		motorHallPeriode[1] =  captureVal - motorHallLastCapVal[3];
		motorHallLastCapVal[3] = captureVal;
	}
}
开发者ID:gerdb,项目名称:street-art-robot,代码行数:35,代码来源:motor.c


示例6: HAL_TIM_IC_CaptureCallback

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
    if(edge == TIM_INPUTCHANNELPOLARITY_RISING) {
        edge = TIM_INPUTCHANNELPOLARITY_FALLING;
        capture_value_raising = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
    }
    else if(edge == TIM_INPUTCHANNELPOLARITY_FALLING) {
        capture_value_falling = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
        float capture_value = capture_value_falling - capture_value_raising;
        distance = ((sonic_velocity * (capture_value / tim_clock)) / 2.0) * 10000; // mm
        USBD_CUSTOM_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&distance, CUSTOM_HID_EPOUT_SIZE);
    }
}
开发者ID:Vadim-Stupakov,项目名称:ProjectX,代码行数:13,代码来源:stm32f4xx_it.c


示例7: HAL_TIM_IC_CaptureCallback

// Callback for sonar echo
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
	int idx;
	uint32_t ic_val = 0;

	// >>>>> Which sonar has received the echo?
	if (htim->Instance == TIM2)
	{
		idx = SONAR_0;
		elapsed_tick[idx] = HAL_GetTick() - trigger_tick[COUPLE_0_2];

		// Update Input Capture times
		ic_val = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
	}
	else if (htim->Instance == TIM3)
	{
		idx = SONAR_1;
		elapsed_tick[idx] = HAL_GetTick() - trigger_tick[COUPLE_0_2];

		// Update Input Capture times
		ic_val = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
	}
	else if (htim->Instance == TIM4)
	{
		idx = SONAR_2;
		elapsed_tick[idx] = HAL_GetTick() - trigger_tick[COUPLE_1_3];

		// Update Input Capture times
		ic_val = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
	}
	else if (htim->Instance == TIM5)
	{
		idx = SONAR_3;
		elapsed_tick[idx] = HAL_GetTick() - trigger_tick[COUPLE_1_3];

		// Update Input Capture times
		ic_val = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
	}
	else
		return; // Should never be here!!!
	// <<<<< Which sonar has received the echo?

	// >>>>> Durations update
	if (ic_val > MAX_DURATION_10_USEC)
		distValid[idx] = 0;
	else
		distValid[idx] = 1;

	echo_duration[idx] = ic_val;
	// <<<<< Durations update
}
开发者ID:RoboSec,项目名称:rs_sensor_board,代码行数:52,代码来源:tim_handler.c


示例8: HAL_TIM_IC_CaptureCallback

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
    uint32_t CCRx_tn=0, CCRx_tn_1=0;

    if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {

        CCRx_tn = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);

        if(htim->Instance == TIM3x) {
            RC2_tn = CCRx_tn;
            intflag2 = 0;
        } else if(htim->Instance == TIM4x) {
            RC3_tn = CCRx_tn;
            intflag3 = 0;
        }
    } else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) {
        CCRx_tn_1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);	// Input capture value

        if(htim->Instance == TIM3x) {
            RC2_tn_1 = CCRx_tn_1;
            intflag2 = 1;
        } else if(htim->Instance == TIM4x) {
            RC3_tn_1 = CCRx_tn_1;
            intflag3 = 1;
        }
    } else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {
        CCRx_tn = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_3);

        if(htim->Instance == TIM3x) {
            RC1_tn = CCRx_tn;
            intflag1 = 0;
        } else if(htim->Instance == TIM4x) {
            RC4_tn = CCRx_tn;
            intflag4 = 0;
        }
    } else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_4) {
        CCRx_tn_1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_4);	// Input capture value

        if(htim->Instance == TIM3x) {
            RC1_tn_1 = CCRx_tn_1;
            intflag1 = 1;
        } else if(htim->Instance == TIM4x) {
            RC4_tn_1 = CCRx_tn_1;
            intflag4 = 1;
        }

//		ExpLedToggle(GREEN_LED);
    }
}
开发者ID:Bosvark,项目名称:STMf401_ahrs,代码行数:49,代码来源:exp_board.c


示例9: TIM1_TRG_COM_TIM17_IRQHandler

// 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
    }
  }
}
开发者ID:callemoon,项目名称:stm32_robot,代码行数:27,代码来源:wheelencoder.c


示例10: HAL_TIM_IC_CaptureCallback

/* USER CODE BEGIN 0 */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
	uint8_t i;
	uint16_t temp;
	temp = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
	if ((temp > 5000) && (!data_ready))
	{
		pointer = 0;
		for (i = 0; i < 4; i++)
		{
			if (captured_value[i] < 1000)
				captured_value[i] = 1000;
			else if (captured_value[i] > 2000)
				captured_value[i] = 2000;
			rc_data[i] = captured_value[i]-1000;
		};
		rc_data[4] = 0;
		if (captured_value[4] > 1500)
			rc_data[4] |= (1<<4);
		if (captured_value[5] > 1500)
			rc_data[4] |= (1<<5);
		if (captured_value[6] > 1500)
			rc_data[4] |= (1<<6);
		if (captured_value[7] > 1500)
			rc_data[4] |= (1<<7);
		data_ready = 1;
	}
	else
	{
		captured_value[pointer] = temp;
		pointer++;
	};
	if (pointer == 8) 
		pointer = 0;	
};
开发者ID:alexeystn,项目名称:stm32-ppm-usb-adapter,代码行数:36,代码来源:main.c


示例11: HAL_TIM_OC_DelayElapsedCallback

/**
  * @brief  Output Compare callback in non blocking mode 
  * @param  htim: TIM OC handle
  * @retval None
  */
void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)
{
  uint32_t capture = 0; 

  /* Get the TIM4 Input Capture 1 value */
  capture = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
  
  /* Set the TIM4 Capture Compare1 Register value */
  __HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_1, (CCR1Val + capture));
}
开发者ID:ljprediger,项目名称:TP_Final_CursoDSP2015,代码行数:15,代码来源:main.c


示例12: detect

void detect(DETECTORSTATUS *st, TIM_HandleTypeDef *htim)
{
	int8_t		shift;
	int16_t		diff;
	uint16_t	lastDelta;
	uint16_t	capturedValue;

	if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1)
	{
		capturedValue = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
		if(st->initialized)
		{
			lastDelta = capturedValue - st->prevCapture;

			st->accumulator += lastDelta;
			//st->debug[st->counter] = lastDelta;
			if(++st->counter == g_config.mccount)
			{
				//HAL_GPIO_TogglePin(ACTIVE1_GPIO_Port, ACTIVE1_Pin);

				st->lastMeasured = st->accumulator;
				st->accumulator = 0;
				st->counter = 0;

				if(!st->sum)
					st->sum = (uint32_t)st->lastMeasured << g_config.sumshift;
				else
				{
					st->avg = st->sum >> g_config.sumshift;
					st->threshold = st->avg / g_config.thdiv;
					st->diff = (int32_t)st->lastMeasured - st->avg;
					st->tolerance = st->threshold >> SHIFT_TOLERANCE;

					diff = -st->diff;

					if (diff < 0)
						st->state = st->tolerance + diff < 0 ? BELOW:BASE;
					else if(diff < st->tolerance)
						st->state = BASE;
					else if(diff < st->threshold)
						st->state = ABOVE;
					else if(st->state < ACTIVE) {	//!ACTIVE && !TIMEOUT
						st->activeStart = HAL_GetTick();
						st->state = ACTIVE;
					} else if(HAL_GetTick() - st->activeStart > g_config.tlimit * 1000)
						st->state = TIMEOUT;

					shift = g_config.shifts[st->state];
					if(shift != SCHAR_MIN) {
						st->correction = (shift >= 0) ? (((int32_t)st->diff) << shift) : (((int32_t)st->diff) >> -shift);
						st->sum += st->correction;
					} else
开发者ID:compihu,项目名称:cardetector,代码行数:52,代码来源:detector.c


示例13: HAL_TIM_IC_CaptureCallback

/**
  * @brief  Conversion complete callback in non blocking mode 
  * @param  htim : hadc handle
  * @retval None
  */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
  if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2)
  {
    if(uhCaptureIndex == 0)
    {
      /* Get the 1st Input Capture value */
      uwIC2Value1 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
      uhCaptureIndex = 1;
    }
    else if(uhCaptureIndex == 1)
    {
      /* Get the 2nd Input Capture value */
      uwIC2Value2 = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2); 

      /* Capture computation */
      if (uwIC2Value2 > uwIC2Value1)
      {
        uwDiffCapture = (uwIC2Value2 - uwIC2Value1); 
      }
      else if (uwIC2Value2 < uwIC2Value1)
      {
        /* 0xFFFF is max TIM3_CCRx value */
        uwDiffCapture = ((0xFFFF - uwIC2Value1) + uwIC2Value2) + 1;
      }
      else
      {
        /* If capture values are equal, we have reached the limit of frequency
           measures */
        Error_Handler();
      }
      /* Frequency computation: for this example TIMx (TIM3) is clocked by
         2xAPB1Clk */      
      uwFrequency = (2*HAL_RCC_GetPCLK1Freq()) / uwDiffCapture;
      uhCaptureIndex = 0;
    }
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF4,代码行数:43,代码来源:main.c


示例14: HAL_TIM_IC_CaptureCallback

/**
 * Callback function implementation.
 * @param htim timer handle which trigger the callback
 */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim) {
	static uint8_t steerRise = 0;

	if (htim->Instance == TIM4) {

		if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1) {

			/* TIM4 Channel 1 (Motor input) */
			uwIC1Value = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
		} else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_3) {

			/* TIM4 Channel 3 (Steer input) */
			uwIC2Value = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_3) - uwIC1Value;
			steerRise = 1;

			if (_signalDetected == RESET) {
				_signalDetected = SET;
				if (_servo == ENABLE)
					HAL_TIM_PWM_Start_IT(&htim4, TIM_CHANNEL_4);

			}

			/* Connect to servo output */
			if (_connected == ENABLE) {
				BSP_Radio_SetSteer(uwIC2Value - 1500);
			}
		} else if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2) {

			/* TIM4 Channel 2 (Motor input, fall edge) */
			if (!steerRise && _signalDetected == SET) {
				_signalDetected = RESET;
				HAL_TIM_PWM_Stop(&htim4, TIM_CHANNEL_4);
			} else if (steerRise) {
				steerRise = 0;
			}
		}
	}
}
开发者ID:csorvagep,项目名称:robotcar,代码行数:42,代码来源:radio.c


示例15: HAL_TIM_IC_CaptureCallback

/**
  * @brief  Input Capture callback in non blocking mode 
  * @param  htim : TIM IC handle
  * @retval None
  */
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
  if (htim->Channel == HAL_TIM_ACTIVE_CHANNEL_2)
  {
    /* Get the Input Capture value */
    uwIC2Value = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_2);
    
    if (uwIC2Value != 0)
    {
      /* Duty cycle computation */
      uwDutyCycle = ((HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1)) * 100) / uwIC2Value;
      
      /* uwFrequency computation
      TIM4 counter clock = (RCC_Clocks.HCLK_Frequency)/2 */      
      uwFrequency = (HAL_RCC_GetHCLKFreq())/2 / uwIC2Value;
    }
    else
    {
      uwDutyCycle = 0;
      uwFrequency = 0;
    }
  }
}
开发者ID:nidhiyanandh,项目名称:STM32Cube_FW_F4_V1.5.0_GCC_Makefile,代码行数:28,代码来源:main.c


示例16: HAL_TIM_IC_CaptureCallback

/**
  * @brief  Input Capture callback in non blocking mode 
  * @param  htim : TIM IC handle
  * @retval None
*/
void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{    
  /* Get the Input Capture value */
  tmpCC4[uwCaptureNumber++] = HAL_TIM_ReadCapturedValue(&Input_Handle, TIM_CHANNEL_1);
  
  if (uwCaptureNumber >= 2)
  {
    /* Compute the period length */
    uwPeriodValue = (uint16_t)(0xFFFF - tmpCC4[0] + tmpCC4[1] + 1);
    
    /* Frequency computation */ 
    uwLsiFreq = (uint32_t) SystemCoreClock / uwPeriodValue;
    uwLsiFreq *= 8;
  }
}
开发者ID:shjere,项目名称:common,代码行数:20,代码来源:main.c


示例17: TIM5_IRQHandler

/**
  * @brief  This function handles TIM5 global interrupt request.
  * @param  None
  * @retval None
  */
void TIM5_IRQHandler(void)
{ 
  HAL_TIM_IRQHandler(&TimInputCaptureHandle);
  {    
    /* Get the Input Capture value */
    tmpCC4[uwCaptureNumber++] = HAL_TIM_ReadCapturedValue(&TimInputCaptureHandle, TIM_CHANNEL_4);
    
    if (uwCaptureNumber >= 2)
    {
      /* Compute the period length */
      uwPeriodValue = (uint16_t)(0xFFFF - tmpCC4[0] + tmpCC4[1] + 1);
      uwMeasurementDone = 1;
      uwCaptureNumber = 0;
    }
  }
}
开发者ID:451506709,项目名称:automated_machine,代码行数:21,代码来源:stm32f4xx_it.c


示例18: TIM1_CC_IRQHandler

// 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;
      }
    }
  }
}
开发者ID:callemoon,项目名称:stm32_robot,代码行数:17,代码来源:wheelencoder.c


示例19: TIM14_IRQHandler

/**
  * @brief  This function handles TIM16 global interrupt request.
  * @param  None
  * @retval None
  */
void TIM14_IRQHandler(void)
{ 
  HAL_TIM_IRQHandler(&Input_Handle);
  {    
    /* Get the Input Capture value */
    tmpCC4[uwCaptureNumber++] = HAL_TIM_ReadCapturedValue(&Input_Handle, TIM_CHANNEL_1);
    
    if (uwCaptureNumber >= 2)
    {
      /* Compute the period length */
      uwPeriodValue = (uint16_t)(0xFFFF - tmpCC4[0] + tmpCC4[1] + 1);
      
      /* Frequency computation */ 
      uwLsiFreq = (uint32_t) SystemCoreClock / uwPeriodValue;
      uwLsiFreq *= 8;
    }
  }
}
开发者ID:PaxInstruments,项目名称:STM32CubeF3,代码行数:23,代码来源:stm32f3xx_it.c


示例20: HAL_TIM_OC_DelayElapsedCallback

/**
  * @brief  Output Compare callback in non blocking mode 
  * @param  htim: TIM OC handle
  * @retval None
  */
void HAL_TIM_OC_DelayElapsedCallback(TIM_HandleTypeDef *htim)
{
  uint32_t capture = 0; 
  
  if(LEDsState == LED3_TOGGLE)
  {
    /* Toggling LED3 */
    BSP_LED_Toggle(LED3);
    BSP_LED_Off(LED6);
    BSP_LED_Off(LED4);
  }
  else if(LEDsState == LED4_TOGGLE)
  {
    /* Toggling LED4 */
    BSP_LED_Toggle(LED4);
    BSP_LED_Off(LED6);
    BSP_LED_Off(LED3);
  }
  else if(LEDsState == LED6_TOGGLE)
  {
    /* Toggling LED6 */
    BSP_LED_Off(LED3);
    BSP_LED_Off(LED4);
    BSP_LED_Toggle(LED6);
  }
  else if(LEDsState == STOP_TOGGLE)
  {
    /* Turn ON LED6 */
    BSP_LED_On(LED6);
  }
  else if(LEDsState == LEDS_OFF)
  {
    /* Turn OFF all LEDs */
    BSP_LED_Off(LED3);
    BSP_LED_Off(LED4);
    BSP_LED_Off(LED5);
    BSP_LED_Off(LED6);
  }
  /* Get the TIM4 Input Capture 1 value */
  capture = HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1);
  
  /* Set the TIM4 Capture Compare1 Register value */
  __HAL_TIM_SET_COMPARE(htim, TIM_CHANNEL_1, (CCR1Val + capture));
}
开发者ID:glocklueng,项目名称:STM32F401-TP_FINAL,代码行数:49,代码来源:main.c



注:本文中的HAL_TIM_ReadCapturedValue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAL_UART_DeInit函数代码示例发布时间:2022-05-30
下一篇:
C++ HAL_TIM_PWM_Start函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap