Still not compiling, yield() function cannot be resolved.

This commit is contained in:
2018-11-05 17:22:27 +01:00
parent 83a5cc0c41
commit 724c622ca4
7 changed files with 54 additions and 25 deletions

View File

@@ -13,6 +13,38 @@
#include "RHReliableDatagram.h"
#ifdef MONGOOSE_OS
/*
static bool s_randomSeedCalled = false;
static void randomSeed(unsigned long seed) {
if(seed != 0) {
srand(seed);
s_randomSeedCalled = true;
}
}
*/
static long random(long howbig) {
if(howbig == 0) {
return 0;
}
// if randomSeed was called, fall back to software PRNG
// uint32_t val = (s_randomSeedCalled) ? rand() : RANDOM_REG32;
uint32_t val = rand();
return val % howbig;
}
static long random(long howsmall, long howbig) {
if(howsmall >= howbig) {
return howsmall;
}
long diff = howbig - howsmall;
return random(diff) + howsmall;
}
#endif
////////////////////////////////////////////////////////////////////
// Constructors
RHReliableDatagram::RHReliableDatagram(RHGenericDriver& driver, uint8_t thisAddress)