True Random Number Generator access.
More...
True Random Number Generator access.
- Author
- shensley
Provides static access to the built-in True Random Number Generator
#include <rng.h>
◆ Random()
daisy::Random::Random |
( |
| ) |
|
|
inline |
◆ ~Random()
daisy::Random::~Random |
( |
| ) |
|
|
inline |
◆ DeInit()
static void daisy::Random::DeInit |
( |
| ) |
|
|
static |
Deinitializes the Peripheral
◆ GetFloat()
static float daisy::Random::GetFloat |
( |
float | min = 0.f, |
|
|
float | max = 1.f ) |
|
static |
Returns a floating point value between the specified minimum and maximum. Calls GetValue() internally.
- Parameters
-
min | the minimum value to return, defaults to 0.f |
max | the maximum value to return, defaults to 1.f |
◆ GetValue()
static uint32_t daisy::Random::GetValue |
( |
| ) |
|
|
static |
Returns a randomly generated 32-bit number This is done by polling the peripheral, and can block for up to 100ms.
To avoid blocking issues, the IsReady function can be used to check if a value is ready before calling this function.
If there is an issue with the peripheral, or a timeout occurs the return value will be 0.
- Returns
- a 32-bit random number
◆ Init()
static void daisy::Random::Init |
( |
| ) |
|
|
static |
Initializes the Peripheral
This is called from System::Init, so the GetValue, and GetFloat functions can be used without the application needing to manually initialize the RNG.
◆ IsReady()
static bool daisy::Random::IsReady |
( |
| ) |
|
|
static |
Checks the peripheral to see if a new value is ready
- Returns
- true if conditioning has finished and a new value can be read
The documentation for this class was generated from the following file: