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:
commit
c932c31f1d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user