source: S-port/trunk/Core/Src/rng.c@ 1

Last change on this file since 1 was 1, checked in by AlexLir, 3 years ago
File size: 280 bytes
Line 
1#include "rng.h"
2
3void RNG_init(void)
4{
5 __HAL_RCC_RNG_CLK_ENABLE();
6 RNG->CR |= RNG_CR_RNGEN;
7}
8
9void RNG_deinit(void)
10{
11 __HAL_RCC_RNG_CLK_DISABLE();
12 RNG->CR &= ~RNG_CR_RNGEN;
13}
14
15uint32_t RNG_get(void)
16{
17 while(!(RNG->SR & RNG_SR_DRDY));
18 return RNG->DR;
19}
Note: See TracBrowser for help on using the repository browser.