1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #8131 from miri64/pkg/fix/emb6

emb6: API updates in hal_getrand()
This commit is contained in:
Martine Lenders 2017-11-24 10:56:44 +01:00 committed by GitHub
commit c932c31f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,9 @@
#include "mutex.h"
#include "periph/gpio.h"
#include "periph/hwrng.h"
#ifdef MODULE_RANDOM
#include "random.h"
#endif
#include "xtimer.h"
#include "target.h"
@ -45,12 +48,12 @@ int8_t hal_init(void)
uint8_t hal_getrand(void)
{
#if RANDOM_NUMOF
#if defined(MODULE_PERIPH_HWRNG)
uint8_t res;
hwnrg_read((char *)&res, sizeof(res));
return res;
#elif defined(MODULE_RANDOM)
return (uint8_t)(genrand_uint32() % UINT8_MAX);
return (uint8_t)(random_uint32() % UINT8_MAX);
#else
return 4; /* keeping the meme alive ;-) */
#endif