stm32H7官方程序ADC_Regular_injected_groups中回调函数

2019-07-20 03:33发布

想请教一下/**  * @brief  Conversion complete callback in non blocking mode
  * @param  AdcHandle : ADC handle
  * @note   This example shows a simple way to report end of conversion
  *         and get conversion result. You can add your own implementation.
  * @retval None
  */
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
   uint32_t tmp_index = 0;
   uint32_t tmp_average = 0;
        /* Variable 32 bits for intermediate processing */
        /* When the 2nd half of the buffer is reached, compute these results while  */
  /* the 1st half of the buffer is updated by the ADC and DMA transfers.      */
  SCB_InvalidateDCache_by_Addr ((uint32_t *)&aADCxConvertedData[ADC_CONVERTED_DATA_BUFFER_SIZE/2], ADC_CONVERTED_DATA_BUFFER_SIZE);
         /* Process average of the 2nd half of the buffer */
  for (tmp_index = 0; tmp_index < (ADC_CONVERTED_DATA_BUFFER_SIZE/2); tmp_index++)
  {
    tmp_average += aADCxConvertedData[tmp_index + (ADC_CONVERTED_DATA_BUFFER_SIZE/2)];
  }
  tmp_average /= (ADC_CONVERTED_DATA_BUFFER_SIZE/2);
  uhADCxConvertedValue_Regular_Avg_half2 = (uint16_t)tmp_average;

  /* Affect pointer to the average of the 2nd half of ADC conversion results  */
  /* table of regular group, channel on rank1.                                */
  puhADCxConvertedValue_Regular_Avg = &uhADCxConvertedValue_Regular_Avg_half2;
}


这个回调函数是做什么用的。是官方H7板子中的程序工程如下。


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
3条回答
正点原子
1楼-- · 2019-07-20 06:42
帮顶
Paprika112233
2楼-- · 2019-07-20 06:57
 精彩回答 2  元偷偷看……
Paprika112233
3楼-- · 2019-07-20 09:48
 精彩回答 2  元偷偷看……

一周热门 更多>