diff --git a/src/omv/rng.c b/src/omv/rng.c deleted file mode 100644 index f42807675..000000000 --- a/src/omv/rng.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the OpenMV project. - * Copyright (c) 2013/2014 Ibrahim Abdelkader - * This work is licensed under the MIT license, see the file LICENSE for details. - * - * RNG (Random Number Generator). - * - */ -#include -#include "rng.h" - -static RNG_HandleTypeDef RNGHandle; - -void rng_init() -{ - __RNG_CLK_ENABLE(); - RNGHandle.Instance = RNG; - HAL_RNG_Init(&RNGHandle); -} - -uint32_t rng_randint(uint32_t min, uint32_t max) -{ - uint32_t rand=0; - if (min==max) { - return 0; - } - - // Wait until the RNG is ready - while (HAL_RNG_GetState(&RNGHandle) != RNG_FLAG_DRDY); - - rand = HAL_RNG_GetRandomNumber(&RNGHandle); - return (rand%(max-min))+min; -} diff --git a/src/omv/rng.h b/src/omv/rng.h deleted file mode 100644 index 3157ad45d..000000000 --- a/src/omv/rng.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the OpenMV project. - * Copyright (c) 2013/2014 Ibrahim Abdelkader - * This work is licensed under the MIT license, see the file LICENSE for details. - * - * RNG (Random Number Generator). - * - */ -#ifndef __RNG_H__ -#define __RNG_H__ -void rng_init(); -uint32_t rng_randint(uint32_t min, uint32_t max); -#endif // __RNG_H__