Skip to content

Commit dd226ca

Browse files
committed
Minor cleanup
1 parent 99b49fe commit dd226ca

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

hal/nrf5340.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,16 @@ int hal_trng_get_entropy(unsigned char *out, unsigned int len)
211211
unsigned int i = 0;
212212

213213
while (i < len) {
214-
while (!((CC_RNG_ISR & 0x01) && (CC_RNG_TRNG_VALID & 0x01))) {}
215-
216214
uint32_t data[6];
217215
uint8_t *data_bytes = (uint8_t *)data;
218-
for (unsigned int word = 0; word < 6; word++) {
216+
unsigned int word, byte;
217+
218+
while (!((CC_RNG_ISR & 0x01) && (CC_RNG_TRNG_VALID & 0x01))) {}
219+
220+
for (word = 0; word < 6; word++) {
219221
data[word] = CC_RNG_EHR_DATA(word);
220222
}
221-
for (unsigned int byte = 0; byte < 24 && i < len; byte++) {
223+
for (byte = 0; byte < 24 && i < len; byte++) {
222224
out[i++] = (unsigned char)data_bytes[byte];
223225
}
224226
}

0 commit comments

Comments
 (0)