Skip to content

Commit

Permalink
tests/adc_ng_entropy: Small test for the ADC-NG entropy collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Marian Buschsieweke committed Feb 13, 2020
1 parent 4b575dc commit 546eaef
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/adc_ng_entropy/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BOARD ?= arduino-nano
include ../Makefile.tests_common

USEMODULE += adc_ng
USEMODULE += adc_ng_util
USEMODULE += fmt

include $(RIOTBASE)/Makefile.include
56 changes: 56 additions & 0 deletions tests/adc_ng_entropy/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2020 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup tests
* @{
*
* @file
* @brief Test application for ADC NG drivers
*
* @author Marian Buschsieweke <marian.buschsieweke@ovgu.de>
*
* @}
*/

#include <stdlib.h>

#include "adc_ng.h"
#include "adc_ng_util.h"
#include "fmt.h"

int main(void)
{
print_str(
"RIOT ADC NG NTC entropy driver test\n"
"===================================\n"
"\n"
);

while (1) {
int8_t entropy[16];
int retval = adc_ng_entropy(0, entropy, sizeof(entropy));
if (retval) {
print_str("adc_ng_entropy() failed with ");
print_s32_dec(retval);
print_str("\n");
return -1;
}
char buf[2];
fmt_byte_hex(buf, entropy[0]);
print(buf, 2);
for (unsigned i = 1; i < sizeof(entropy); i++) {
print(" ", 1);
fmt_byte_hex(buf, entropy[i]);
print(buf, 2);
}
print("\n", 1);
}

return 0;
}

0 comments on commit 546eaef

Please sign in to comment.