Wakeup Light with touch user interface, anti-aliased Font, SD card access and RTC usage on STM32F746NG-DISCO board
Dependencies: BSP_DISCO_F746NG_patch_fixed LCD_DISCO_F746NG TS_DISCO_F746NG FATFileSystem TinyJpgDec_interwork mbed-src
tm_stm32_rng.c
00001 /** 00002 * |---------------------------------------------------------------------- 00003 * | Copyright (C) Tilen Majerle, 2014 00004 * | 00005 * | This program is free software: you can redistribute it and/or modify 00006 * | it under the terms of the GNU General Public License as published by 00007 * | the Free Software Foundation, either version 3 of the License, or 00008 * | any later version. 00009 * | 00010 * | This program is distributed in the hope that it will be useful, 00011 * | but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * | GNU General Public License for more details. 00014 * | 00015 * | You should have received a copy of the GNU General Public License 00016 * | along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 * |---------------------------------------------------------------------- 00018 */ 00019 #include "tm_stm32_rng.h" 00020 00021 void TM_RNG_Init(void) { 00022 /* Enable RNG clock source */ 00023 __HAL_RCC_RNG_CLK_ENABLE(); 00024 00025 /* RNG Peripheral enable */ 00026 RNG->CR |= RNG_CR_RNGEN; 00027 } 00028 00029 void TM_RNG_DeInit(void) { 00030 /* Disable RNG peripheral */ 00031 RNG->CR &= ~RNG_CR_RNGEN; 00032 00033 /* Disable RNG clock source */ 00034 __HAL_RCC_RNG_CLK_DISABLE(); 00035 } 00036 00037 uint32_t TM_RNG_Get(void) { 00038 /* Wait until one RNG number is ready */ 00039 while (!(RNG->SR & (RNG_SR_DRDY))); 00040 00041 /* Get a 32-bit Random number */ 00042 return RNG->DR; 00043 }
Generated on Tue Jul 12 2022 21:40:04 by 1.7.2