STM32F4xx_HAL_Driver  1.8.3
Peripheral Control functions

Peripheral Control functions. More...

+ Collaboration diagram for Peripheral Control functions:

Functions

uint32_t HAL_RNG_GetRandomNumber (RNG_HandleTypeDef *hrng)
 Returns generated random number in polling mode (Obsolete) Use HAL_RNG_GenerateRandomNumber() API instead. More...
 
uint32_t HAL_RNG_GetRandomNumber_IT (RNG_HandleTypeDef *hrng)
 Returns a 32-bit random number with interrupt enabled (Obsolete), Use HAL_RNG_GenerateRandomNumber_IT() API instead. More...
 
HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber (RNG_HandleTypeDef *hrng, uint32_t *random32bit)
 Generates a 32-bit random number. More...
 
HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber_IT (RNG_HandleTypeDef *hrng)
 Generates a 32-bit random number in interrupt mode. More...
 
uint32_t HAL_RNG_ReadLastRandomNumber (const RNG_HandleTypeDef *hrng)
 Read latest generated random number. More...
 
void HAL_RNG_IRQHandler (RNG_HandleTypeDef *hrng)
 Handles RNG interrupt request. More...
 
void HAL_RNG_ErrorCallback (RNG_HandleTypeDef *hrng)
 RNG error callbacks. More...
 
void HAL_RNG_ReadyDataCallback (RNG_HandleTypeDef *hrng, uint32_t random32bit)
 Data Ready callback in non-blocking mode. More...
 

Detailed Description

Peripheral Control functions.

 ===============================================================================
                      ##### Peripheral Control functions #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Get the 32 bit Random number
      (+) Get the 32 bit Random number with interrupt enabled
      (+) Handle RNG interrupt request

Function Documentation

◆ HAL_RNG_ErrorCallback()

__weak void HAL_RNG_ErrorCallback ( RNG_HandleTypeDef *  hrng)

RNG error callbacks.

Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
Return values
None

Definition at line 792 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_GenerateRandomNumber()

HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber ( RNG_HandleTypeDef *  hrng,
uint32_t *  random32bit 
)

Generates a 32-bit random number.

Note
Each time the random number data is read the RNG_FLAG_DRDY flag is automatically cleared.
Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
random32bitpointer to generated random number variable if successful.
Return values
HALstatus

Definition at line 536 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_GenerateRandomNumber_IT()

HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber_IT ( RNG_HandleTypeDef *  hrng)

Generates a 32-bit random number in interrupt mode.

Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
Return values
HALstatus

Definition at line 594 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_GetRandomNumber()

uint32_t HAL_RNG_GetRandomNumber ( RNG_HandleTypeDef *  hrng)

Returns generated random number in polling mode (Obsolete) Use HAL_RNG_GenerateRandomNumber() API instead.

Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
Return values
Randomvalue

Definition at line 629 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_GetRandomNumber_IT()

uint32_t HAL_RNG_GetRandomNumber_IT ( RNG_HandleTypeDef *  hrng)

Returns a 32-bit random number with interrupt enabled (Obsolete), Use HAL_RNG_GenerateRandomNumber_IT() API instead.

Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
Return values
32-bitrandom number

Definition at line 648 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_IRQHandler()

void HAL_RNG_IRQHandler ( RNG_HandleTypeDef *  hrng)

Handles RNG interrupt request.

Note
In the case of a clock error, the RNG is no more able to generate random numbers because the PLL48CLK clock is not correct. User has to check that the clock controller is correctly configured to provide the RNG clock and clear the CEIS bit using __HAL_RNG_CLEAR_IT(). The clock error has no impact on the previously generated random numbers, and the RNG_DR register contents can be used.
In the case of a seed error, the generation of random numbers is interrupted as long as the SECS bit is '1'. If a number is available in the RNG_DR register, it must not be used because it may not have enough entropy. In this case, it is recommended to clear the SEIS bit using __HAL_RNG_CLEAR_IT(), then disable and enable the RNG peripheral to reinitialize and restart the RNG.
User-written HAL_RNG_ErrorCallback() API is called once whether SEIS or CEIS are set.
Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
Return values
None

Definition at line 689 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_ReadLastRandomNumber()

uint32_t HAL_RNG_ReadLastRandomNumber ( const RNG_HandleTypeDef *  hrng)

Read latest generated random number.

Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
Return values
randomvalue

Definition at line 764 of file stm32f4xx_hal_rng.c.

◆ HAL_RNG_ReadyDataCallback()

__weak void HAL_RNG_ReadyDataCallback ( RNG_HandleTypeDef *  hrng,
uint32_t  random32bit 
)

Data Ready callback in non-blocking mode.

Parameters
hrngpointer to a RNG_HandleTypeDef structure that contains the configuration information for RNG.
random32bitgenerated random number.
Return values
None

Definition at line 776 of file stm32f4xx_hal_rng.c.