/** * @brief This function provides minimum delay (in milliseconds) based * on variable incremented. * @note In the default implementation , SysTick timer is the source of time * base. It is used to generate interrupts at regular time intervals where * uwTick is incremented. * @note This function is declared as __weak to be overwritten in case of other * implementations in user file. * @param Delay specifies the delay time length, in milliseconds. * @retval None */ __weak voidHAL_Delay(uint32_t Delay) { uint32_t tickstart = HAL_GetTick(); uint32_t wait = Delay;
/* Add a freq to guarantee minimum wait */ if (wait < HAL_MAX_DELAY) { wait += (uint32_t)(uwTickFreq); }
/** * @brief This function configures the source of the time base. * The time source is configured to have 1ms time base with a dedicated * Tick interrupt priority. * @note This function is called automatically at the beginning of program * after reset by HAL_Init() or at any time when clock is reconfigured by * HAL_RCC_ClockConfig(). * @note In the default implementation, SysTick timer is the source of time * base. It is used to generate interrupts at regular time intervals. Care must * be taken if HAL_Delay() is called from a peripheral ISR process, The SysTick * interrupt must have higher priority (numerically lower) than the peripheral * interrupt. Otherwise the caller ISR process will be blocked. The function is * declared as __weak to be overwritten in case of other implementation in * user file. * @param TickPriority Tick interrupt priority. * @retval HAL status */ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) { /* Configure the SysTick to have interrupt in 1ms time basis*/ if (HAL_SYSTICK_Config(SystemCoreClock / (1000U / uwTickFreq)) > 0U) { return HAL_ERROR; }