求组,用Cube生存的工程,它里面有例程;他例程库文件
STM32f1xx_hal_
tim.c定义了回调函数:如
__weak void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(htim);
/* NOTE : This function Should not be modified, when the callback is needed,
the __HAL_TIM_PeriodElapsedCallback could be implemented in the user file
*/
}
然后他在main.c又定义了:如
/**
* @brief Period elapsed callback in non blocking mode
* @param htim : TIM handle
* @retval None
*/
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
BSP_LED_Toggle(LED2);
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5);
}
问题:为什么他的工程编译时不会报:Symbol HAL_TIM_PeriodElapsedCallback multiply defined 错误,我的会呢?
/* USER CODE BEGIN 0 */
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_5);
}
/* USER CODE END 0 */
但是编译报错,这是为何:
EWEW.axf: Error: L6200E: Symbol HAL_TIM_PeriodElapsedCallback multiply defined (by main.o and stm32f1xx_hal_timebase_tim.o).
一周热门 更多>