0
\$\begingroup\$

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
asked Dec 13, 2018 at 15:13
\$\endgroup\$
3
  • \$\begingroup\$ Can you trace back where the field above is defined? \$\endgroup\$ Commented 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\$ Commented 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\$ Commented Dec 13, 2018 at 15:52

1 Answer 1

1
\$\begingroup\$
#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
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.