1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 20:49:49 +04:00

furi_hal_random: Wait for ready state and no errors before sampling (#3933)

When random output is not ready, but error state flags are not set,
sampling of random generator samples zero until next value is ready.
This commit is contained in:
Nikolay Marchuk
2024-10-06 22:56:35 +07:00
committed by GitHub
parent 00c1611c33
commit cfb9c991cb

View File

@@ -11,7 +11,7 @@
#define TAG "FuriHalRandom"
static uint32_t furi_hal_random_read_rng(void) {
while(LL_RNG_IsActiveFlag_CECS(RNG) && LL_RNG_IsActiveFlag_SECS(RNG) &&
while(LL_RNG_IsActiveFlag_CECS(RNG) || LL_RNG_IsActiveFlag_SECS(RNG) ||
!LL_RNG_IsActiveFlag_DRDY(RNG)) {
/* Error handling as described in RM0434, pg. 582-583 */
if(LL_RNG_IsActiveFlag_CECS(RNG)) {