mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-18 11:03:50 +01:00
tests/periph_random: fix warnings, conventions
This commit is contained in:
parent
adb24b06b8
commit
3d9003f18a
@ -20,16 +20,15 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <vtimer.h>
|
|
||||||
#include <periph/random.h>
|
#include "vtimer.h"
|
||||||
#include <periph_conf.h>
|
#include "periph/random.h"
|
||||||
|
|
||||||
#define LIMIT (20U)
|
#define LIMIT (20U)
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
char buf[LIMIT];
|
char buf[LIMIT];
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
puts("\nRandom number generator low-level driver test\n");
|
puts("\nRandom number generator low-level driver test\n");
|
||||||
printf("This test will print from 1 to %i random bytes about every second\n\n", LIMIT);
|
printf("This test will print from 1 to %i random bytes about every second\n\n", LIMIT);
|
||||||
@ -42,9 +41,9 @@ int main(void)
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
/* create random numbers */
|
/* create random numbers */
|
||||||
for (int i = 1; i <= LIMIT; i++) {
|
for (unsigned i = 1; i <= LIMIT; i++) {
|
||||||
printf("generating %i random byte(s)\n", i);
|
printf("generating %i random byte(s)\n", i);
|
||||||
count = random_read(buf, i);
|
unsigned count = random_read(buf, i);
|
||||||
|
|
||||||
if (count != i) {
|
if (count != i) {
|
||||||
printf("Error generating random bytes, got %i instead of %i", count, i);
|
printf("Error generating random bytes, got %i instead of %i", count, i);
|
||||||
@ -52,8 +51,8 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf("Got:");
|
printf("Got:");
|
||||||
for (int j = 0; j < i; j++) {
|
for (unsigned j = 0; j < i; j++) {
|
||||||
printf(" 0x%02x", buf[j]);
|
printf(" 0x%02x", (unsigned char)buf[j]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user