This is a peripheral object that summarizes the procedures for using the chip’s built-in random number generation hardware.
mwf_periph_rng
- TRNG
This implements the_rng
, a peripheral object that summarizes the procedures for using the chip’s built-in random number generation hardware.
With TWENET, this is used implicitly, so no initialization procedure is required in the user’s program.
Code example
if (!mwf::the_rng) {
mwf::rng::global_init_rng_manager();
mwf::the_rng->init();
}
uint32_t val = mwf::the_rng->random();
class mwf::periph::rng
global_init_rng_manager()
, global_deinit_rng_manager()
static void global_init_rng_manager();
static void global_deinit_rng_manager();
These functions create and destroy the the_rng
class object. The class object is automatically initialized upon creation, and random values can then be obtained.
random()
uint32_t random()
Returns a random value.
class mwf::periph::rng
(sys_ev_handler
)
on_sleep()
Performs the TRNG stop procedure.
on_wakeup()
Performs the TRNG startup procedure.