STM32G474xx HAL User Manual
函数
初始化和反初始化函数
HAL Exported Functions

HAL初始化和反初始化函数。 更多...

函数

HAL_StatusTypeDef HAL_Init (void)
 此函数用于配置Flash预取、指令和数据缓存、时基源、NVIC以及任何所需的全局底层硬件,通过调用HAL_MspInit()回调函数,该函数可选择在用户文件stm32g4xx_hal_msp.c中定义。
HAL_StatusTypeDef HAL_DeInit (void)
 此函数反初始化HAL的公共部分并停止时基源。
__weak void HAL_MspInit (void)
 初始化MSP。
__weak void HAL_MspDeInit (void)
 反初始化MSP。
__weak HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority)
 此函数配置时基源:配置时基源以提供1ms的时间基准,并具有专用的Tick中断优先级。

详细说明

HAL初始化和反初始化函数。

 ===============================================================================
              ##### Initialization and Configuration functions #####
 ===============================================================================
    [..]  This section provide functions allowing to:
      (+) Initialize the Flash interface the NVIC allocation and initial time base
          clock configuration.
      (+) De-Initialize common part of the HAL.
      (+) Configure the time base source to have 1ms time base with a dedicated
          Tick interrupt priority.
        (++) SysTick timer is used by default as source of time base, but user
             can eventually implement his proper time base source (a general purpose
             timer for example or other time source), keeping in mind that Time base
             duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
             handled in milliseconds basis.
        (++) Time base configuration function (HAL_InitTick ()) is called automatically
             at the beginning of the program after reset by HAL_Init() or at any time
             when clock is configured, by HAL_RCC_ClockConfig().
        (++) Source of time base is configured  to generate interrupts at regular
             time intervals. Care must be taken if HAL_Delay() is called from a
             peripheral ISR process, the Tick interrupt line must have higher priority
            (numerically lower) than the peripheral interrupt. Otherwise the caller
            ISR process will be blocked.
       (++) functions affecting time base configurations are declared as __weak
             to make  override possible  in case of other  implementations in user file.

函数文档

HAL_StatusTypeDef HAL_DeInit ( void  )
HAL_StatusTypeDef HAL_Init ( void  )

此函数用于配置Flash预取、指令和数据缓存、时基源、NVIC以及任何所需的全局底层硬件,通过调用HAL_MspInit()回调函数,该函数可选择在用户文件stm32g4xx_hal_msp.c中定义。

注意:
HAL_Init()函数在程序复位后且在时钟配置之前被调用。
在默认实现中,系统定时器(Systick)用作时基源。Systick配置基于HSI时钟,因为HSI是系统复位后使用的时钟,且NVIC配置设置为优先级组4。一旦完成,时基tick开始递增:tick变量计数器在SysTick_Handler()中断处理程序中每1ms递增一次。
返回值:
HAL状态

定义于文件stm32g4xx_hal.c第148行

参考文献 __HAL_FLASH_DATA_CACHE_DISABLE, __HAL_FLASH_INSTRUCTION_CACHE_DISABLE, __HAL_FLASH_PREFETCH_BUFFER_ENABLE, HAL_InitTick(), HAL_MspInit(), HAL_NVIC_SetPriorityGrouping(), NVIC_PRIORITYGROUP_4, 和 TICK_INT_PRIORITY.

HAL_StatusTypeDef HAL_InitTick ( uint32_t  TickPriority)

此函数配置时基源:配置时基源以提供1ms的时间基准,并具有专用的Tick中断优先级。

注意:
此函数在程序复位后由HAL_Init()自动调用,或在任何时候由HAL_RCC_ClockConfig()重新配置时钟时调用。
在默认实现中,SysTick定时器用作时基源。它用于以规则的时间间隔生成中断。如果从外设ISR进程调用HAL_Delay(),则SysTick中断必须具有比外设中断更高的优先级(数值更低)。否则调用者ISR进程将被阻塞。该函数声明为__weak,以便在用户文件中有其他实现时被覆盖。
参数:
TickPriority,:Tick中断优先级。
返回值:
HAL状态

定义于文件stm32g4xx_hal.c第255行

参考文献 HAL_NVIC_SetPriority(), HAL_SYSTICK_Config(), uwTickFreq, 和 uwTickPrio.

被以下函数引用:HAL_Init(), HAL_RCC_ClockConfig(), HAL_RCC_DeInit(), HAL_RCC_OscConfig(), 和 HAL_SetTickFreq().

void HAL_MspDeInit ( void  )

反初始化MSP。

返回值:

定义于文件stm32g4xx_hal.c第232行

被以下函数引用:HAL_DeInit().

void HAL_MspInit ( void  )

初始化MSP。

返回值:

定义于文件stm32g4xx_hal.c第221行

被以下函数引用:HAL_Init().