Reading STM32F timer value
#define __HAL_TIM_GET_COUNTER(__HANDLE__) \
   ((__HANDLE__)-&gt;Instance-&gt;CNT)


Above is defined in stmf32f0xx_hal_tim.h, which is probably not enabled or included.
Fix that, or use TIM7-&gt;CNT.