Class library for using the true Random Number Generator on STM32F4xxx devices.

Dependents:   MCU-Benchmark-Sute Doom_Flame-F429ZI_v02 Wether_Meter

Revision:
0:1c605984e361
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/STM32F4_RNG.cpp	Mon Feb 08 20:15:12 2016 +0000
@@ -0,0 +1,15 @@
+#include "STM32F4_RNG.h"
+#include "mbed.h"
+
+
+STM32F4_RNG::STM32F4_RNG() {
+    RCC->AHB2ENR |= RCC_AHB2ENR_RNGEN;  /* Enable RNG clock source */
+    RNG->CR |= RNG_CR_RNGEN;            /* RNG Peripheral enable */
+}
+
+
+unsigned long STM32F4_RNG::Get() {
+    while (!(RNG->SR & (RNG_SR_DRDY))); /* Wait until one RNG number is ready */
+
+    return RNG->DR;                     /* Get a 32-bit Random number */
+}
\ No newline at end of file