想请教一下/** * @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板子中的程序工程如下。
一周热门 更多>