Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MCU-Benchmark-Sute Doom_Flame-F429ZI_v02 Wether_Meter
STM32F4_RNG.cpp
- Committer:
- grantphillips
- Date:
- 2016-02-08
- Revision:
- 0:1c605984e361
File content as of revision 0:1c605984e361:
#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 */
}