mirror of https://github.com/ARMmbed/mbed-os.git
Added pseudo random seed source from compiler -D option
parent
8fab5bca18
commit
2415d391d7
|
|
@ -1,6 +1,7 @@
|
|||
#include "test_env.h"
|
||||
|
||||
void led_blink(PinName led, float delay) {
|
||||
void led_blink(PinName led, float delay)
|
||||
{
|
||||
if (led != NC) {
|
||||
DigitalOut myled(led);
|
||||
while (1) {
|
||||
|
|
@ -11,18 +12,29 @@ void led_blink(PinName led, float delay) {
|
|||
while(1);
|
||||
}
|
||||
|
||||
void notify_start() {
|
||||
void notify_start()
|
||||
{
|
||||
printf("{{start}}" NL);
|
||||
}
|
||||
|
||||
void notify_completion(bool success) {
|
||||
void notify_completion(bool success)
|
||||
{
|
||||
if (success) {
|
||||
printf("{{success}}" NL);
|
||||
} else {
|
||||
printf("{{failure}}" NL);
|
||||
}
|
||||
|
||||
printf("{{end}}" NL);
|
||||
|
||||
led_blink(LED1, success ? 1.0 : 0.1);
|
||||
}
|
||||
|
||||
// -DMBED_BUILD_TIMESTAMP=1406208182.13
|
||||
unsigned int testenv_randseed()
|
||||
{
|
||||
unsigned int seed = 0;
|
||||
#ifdef MBED_BUILD_TIMESTAMP
|
||||
long long_seed = MBED_BUILD_TIMESTAMP * 100.0f;
|
||||
seed = long_seed & 0xFFFFFFFF;
|
||||
#endif /* MBED_BUILD_TIMESTAMP */
|
||||
return seed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@
|
|||
#include <stdio.h>
|
||||
#include "mbed.h"
|
||||
|
||||
#define NL "\n"
|
||||
#define NL "\n"
|
||||
|
||||
// Test result related notification functions
|
||||
void led_blink(PinName led, float delay);
|
||||
|
||||
void notify_start();
|
||||
|
||||
void notify_completion(bool success);
|
||||
|
||||
// Test functionality useful during testing
|
||||
unsigned int testenv_randseed();
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue