Initialization and De-initialization Functions

Initialization and de-initialization functions. More...

Functions

hal_status_t hal_init (void)
 This function configures time base source, NVIC and Low level hardware. More...
 
hal_status_t hal_deinit (void)
 This function de-initializes common part of the HAL and stops the source of time base. More...
 
void hal_msp_init (void)
 Initialize the MSP. More...
 
void hal_msp_deinit (void)
 De-initialize the MSP. More...
 
hal_status_t hal_init_tick (uint32_t tick_priority)
 This function configures the source of the time base. More...
 

Detailed Description

Initialization and de-initialization functions.

 ===============================================================================
              ##### Initialization and de-initialization functions #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Initialize the Flash interface, the NVIC allocation and initial clock
          configuration. It also initializes the source of time base when timeout
          is needed.
      (+) 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 or her proper time base source (a general purpose
             timer for example or other time source), keeping in mind that Time base
             duration should be kept as 1ms since PPP_TIMEOUT_VALUEs are defined and
             handled in milliseconds basis.
        (++) Time base configuration function (hal_init_tick()) is called automatically
             at the beginning of the program after reset by hal_init().
        (++) 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.

Function Documentation

◆ hal_deinit()

hal_status_t hal_deinit ( void  )

This function de-initializes common part of the HAL and stops the source of time base.

Note
This function is optional.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_init()

hal_status_t hal_init ( void  )

This function configures time base source, NVIC and Low level hardware.

Note
This function is called at the beginning of program after reset and before the clock configuration. The SysTick configuration is based on AHB clock and the NVIC configuration is set to Priority group 4. When the time base configuration is done, time base tick starts incrementing. In the default implementation, SysTick is used as source of time base. The tick variable is incremented each 1ms in its ISR.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_init_tick()

hal_status_t hal_init_tick ( uint32_t  tick_priority)

This function configures the source of the time base.

Parameters
[in]tick_priorityTick interrupt priority.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_msp_deinit()

void hal_msp_deinit ( void  )

De-initialize the MSP.

Note
This function should not be modified. When the callback is needed, the hal_msp_deinit could be implemented in the user file.

◆ hal_msp_init()

void hal_msp_init ( void  )

Initialize the MSP.

Note
This function should not be modified. When the callback is needed, the hal_msp_init could be implemented in the user file.