High level interface to the True Random Number Generator (TRNG).
This block uses dedicated hardware to efficiently generate true random numbers.
cyhal_trng_init initializes the TRNG and passes a pointer to the TRNG block through the obj object of type cyhal_trng_t.
See Simple TRNG number generation example.
The following snippet initializes a TRNG and generates a true random number.
API Reference | |
TRNG HAL Results | |
TRNG specific return codes. | |
Functions | |
cy_rslt_t | cyhal_trng_init (cyhal_trng_t *obj) |
Initialize the random number generator. More... | |
void | cyhal_trng_free (cyhal_trng_t *obj) |
Release the random number generator. More... | |
uint32_t | cyhal_trng_generate (const cyhal_trng_t *obj) |
Generate a random number. More... | |
cy_rslt_t cyhal_trng_init | ( | cyhal_trng_t * | obj | ) |
Initialize the random number generator.
[out] | obj | Pointer to a random number generator object. The caller must allocate the memory for this object but the init function will initialize its contents. |
Returns CY_RSLT_SUCCESS if the operation was successful
void cyhal_trng_free | ( | cyhal_trng_t * | obj | ) |
Release the random number generator.
[in,out] | obj | The random number generator object |
uint32_t cyhal_trng_generate | ( | const cyhal_trng_t * | obj | ) |
Generate a random number.
[in] | obj | The random number generator object |