mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/sam0/periph: remove bitfield usage in trng driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
This commit is contained in:
parent
38c65b9531
commit
37b03d8172
@ -26,15 +26,16 @@
|
|||||||
void hwrng_init(void)
|
void hwrng_init(void)
|
||||||
{
|
{
|
||||||
/* Enable the MCLK */
|
/* Enable the MCLK */
|
||||||
MCLK->APBCMASK.bit.TRNG_ = 1;
|
MCLK->APBCMASK.reg |= MCLK_APBCMASK_TRNG;
|
||||||
|
|
||||||
/* Enable the TRNG */
|
/* Enable the TRNG */
|
||||||
TRNG->CTRLA.bit.ENABLE = 1;
|
TRNG->CTRLA.reg |= TRNG_CTRLA_ENABLE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t hwrand(void)
|
uint32_t hwrand(void)
|
||||||
{
|
{
|
||||||
while (!TRNG->INTFLAG.bit.DATARDY) {}
|
while (!(TRNG->INTFLAG.reg & TRNG_INTFLAG_DATARDY)) {}
|
||||||
return TRNG->DATA.reg;
|
return TRNG->DATA.reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user