\$\begingroup\$
\$\endgroup\$
3
I am trying to implement a hardware timer for STM32F and read the value from it. So far, this is my implementation:
static TIM_HandleTypeDef s_TimerInstance = {.Instance = TIM7};
void vConfigureTimerForRunTimeStats()
{
__TIM7_CLK_ENABLE();;
HAL_TIM_Base_Start(&s_TimerInstance);
while (true)
{
__HAL_TIM_GET_COUNTER(&s_TimerInstance);
delay(100);
}
}
I am getting the following error:
Field '__HAL_TIM_GET_COUNTER(&s_TimerInstance)' could not be
resolved
Can anyone help me out on this?
Bence Kaulics
6,47312 gold badges35 silver badges61 bronze badges
-
\$\begingroup\$ Can you trace back where the field above is defined? \$\endgroup\$Long Pham– Long Pham2018年12月13日 15:33:55 +00:00Commented Dec 13, 2018 at 15:33
-
\$\begingroup\$ tracing back takes me to stm32f0xx_hal_tim.h header file, which is included in my include \$\endgroup\$Nil– Nil2018年12月13日 15:35:09 +00:00Commented Dec 13, 2018 at 15:35
-
1\$\begingroup\$ When you ask about a particular function in a library, it would be very helpful if you provided a link to that library. \$\endgroup\$user103380– user1033802018年12月13日 15:52:24 +00:00Commented Dec 13, 2018 at 15:52
1 Answer 1
\$\begingroup\$
\$\endgroup\$
#define __HAL_TIM_GET_COUNTER(__HANDLE__) \
((__HANDLE__)->Instance->CNT)
Above is defined in stmf32f0xx_hal_tim.h
, which is probably not enabled or included.
Fix that, or use TIM7->CNT
.
answered Dec 13, 2018 at 15:48
lang-c