1.8.23.3 TRNG_CallbackRegister Function

C

void TRNG_CallbackRegister( TRNG_CALLBACK callback, uintptr_t context )

Summary

Sets the pointer to the function (and it's context) to be called when the random number is ready to be read.

Description

This function sets the pointer to a client function to be called "back" when the random number is ready. It also accepts a context value that is passed into the function when it is called.

This function is available only in interrupt mode of operation.

Precondition

None.

Parameters

Param Description
callback A pointer to a function with a calling signature defined by the TRNG_CALLBACK data type.
context A value (usually a pointer) passed (unused) into the function identified by the callback parameter.

Returns

None.

Example

uint32_t randomValue;

void testCallback( uint32_t random, uintptr_t context)
{
    randomValue= random;
}

TRNG_CallbackRegister(testCallback, NULL);

Remarks

The context value may be set to NULL if it is not required. In this case the value NULL will be passed to the callback function.

To disable the callback function, pass a NULL for the callback parameter. See the TRNG_CALLBACK type definition for additional information.