diff --git a/libraries/AP_HAL/examples/RNG_test/RNG_test.cpp b/libraries/AP_HAL/examples/RNG_test/RNG_test.cpp new file mode 100644 index 0000000000..546b611880 --- /dev/null +++ b/libraries/AP_HAL/examples/RNG_test/RNG_test.cpp @@ -0,0 +1,27 @@ +/* + simple test of Random Number Generation + */ + +#include + +void setup(); +void loop(); + +const AP_HAL::HAL& hal = AP_HAL::get_HAL(); + +void setup(void) { + hal.console->printf("Running Random Number Generator Test!\n"); +} + +void loop(void) +{ + uint32_t random_number; + if (hal.util->get_random_vals((uint8_t*)&random_number, sizeof(random_number))) { + hal.console->printf("RNG %lx\n", (unsigned long)random_number); + } else { + hal.console->printf("RNG failed\n"); + } + hal.scheduler->delay(1000); +} + +AP_HAL_MAIN(); \ No newline at end of file diff --git a/libraries/AP_HAL/examples/RNG_test/wscript b/libraries/AP_HAL/examples/RNG_test/wscript new file mode 100644 index 0000000000..719ec151ba --- /dev/null +++ b/libraries/AP_HAL/examples/RNG_test/wscript @@ -0,0 +1,7 @@ +#!/usr/bin/env python +# encoding: utf-8 + +def build(bld): + bld.ap_example( + use='ap', + )