-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/adc_ng_entropy: Small test for the ADC-NG entropy collection
- Loading branch information
Marian Buschsieweke
committed
Feb 13, 2020
1 parent
4b575dc
commit 546eaef
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |