Browse Source

AP_HAL: add Random Number Generation test

gps-1.3.1
Siddharth Purohit 4 years ago committed by Andrew Tridgell
parent
commit
6a0c4ec3f7
  1. 27
      libraries/AP_HAL/examples/RNG_test/RNG_test.cpp
  2. 7
      libraries/AP_HAL/examples/RNG_test/wscript

27
libraries/AP_HAL/examples/RNG_test/RNG_test.cpp

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
/*
simple test of Random Number Generation
*/
#include <AP_HAL/AP_HAL.h>
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();

7
libraries/AP_HAL/examples/RNG_test/wscript

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
#!/usr/bin/env python
# encoding: utf-8
def build(bld):
bld.ap_example(
use='ap',
)
Loading…
Cancel
Save