Still not compiling, yield() function cannot be resolved.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user