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

Committer:
the_sz
Date:
Sun Jan 31 01:02:36 2016 +0000
Revision:
12:a89096944f20
date adjust added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
the_sz 12:a89096944f20 1 /**
the_sz 12:a89096944f20 2 * |----------------------------------------------------------------------
the_sz 12:a89096944f20 3 * | Copyright (C) Tilen Majerle, 2014
the_sz 12:a89096944f20 4 * |
the_sz 12:a89096944f20 5 * | This program is free software: you can redistribute it and/or modify
the_sz 12:a89096944f20 6 * | it under the terms of the GNU General Public License as published by
the_sz 12:a89096944f20 7 * | the Free Software Foundation, either version 3 of the License, or
the_sz 12:a89096944f20 8 * | any later version.
the_sz 12:a89096944f20 9 * |
the_sz 12:a89096944f20 10 * | This program is distributed in the hope that it will be useful,
the_sz 12:a89096944f20 11 * | but WITHOUT ANY WARRANTY; without even the implied warranty of
the_sz 12:a89096944f20 12 * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
the_sz 12:a89096944f20 13 * | GNU General Public License for more details.
the_sz 12:a89096944f20 14 * |
the_sz 12:a89096944f20 15 * | You should have received a copy of the GNU General Public License
the_sz 12:a89096944f20 16 * | along with this program. If not, see <http://www.gnu.org/licenses/>.
the_sz 12:a89096944f20 17 * |----------------------------------------------------------------------
the_sz 12:a89096944f20 18 */
the_sz 12:a89096944f20 19 #include "tm_stm32_rng.h"
the_sz 12:a89096944f20 20
the_sz 12:a89096944f20 21 void TM_RNG_Init(void) {
the_sz 12:a89096944f20 22 /* Enable RNG clock source */
the_sz 12:a89096944f20 23 __HAL_RCC_RNG_CLK_ENABLE();
the_sz 12:a89096944f20 24
the_sz 12:a89096944f20 25 /* RNG Peripheral enable */
the_sz 12:a89096944f20 26 RNG->CR |= RNG_CR_RNGEN;
the_sz 12:a89096944f20 27 }
the_sz 12:a89096944f20 28
the_sz 12:a89096944f20 29 void TM_RNG_DeInit(void) {
the_sz 12:a89096944f20 30 /* Disable RNG peripheral */
the_sz 12:a89096944f20 31 RNG->CR &= ~RNG_CR_RNGEN;
the_sz 12:a89096944f20 32
the_sz 12:a89096944f20 33 /* Disable RNG clock source */
the_sz 12:a89096944f20 34 __HAL_RCC_RNG_CLK_DISABLE();
the_sz 12:a89096944f20 35 }
the_sz 12:a89096944f20 36
the_sz 12:a89096944f20 37 uint32_t TM_RNG_Get(void) {
the_sz 12:a89096944f20 38 /* Wait until one RNG number is ready */
the_sz 12:a89096944f20 39 while (!(RNG->SR & (RNG_SR_DRDY)));
the_sz 12:a89096944f20 40
the_sz 12:a89096944f20 41 /* Get a 32-bit Random number */
the_sz 12:a89096944f20 42 return RNG->DR;
the_sz 12:a89096944f20 43 }