Added randomization.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14406 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
282cbaad2e
commit
35621dd185
|
@ -135,6 +135,20 @@ static void continuous_cb(virtual_timer_t *vtp, void *p) {
|
|||
(void)vtp;
|
||||
(void)p;
|
||||
vtcus++;
|
||||
|
||||
#if VT_STORM_CFG_RANDOMIZE != FALSE
|
||||
/* Pseudo-random delay.*/
|
||||
{
|
||||
static volatile unsigned x = 0;
|
||||
unsigned r;
|
||||
|
||||
chSysLockFromISR();
|
||||
r = rand() & 255;
|
||||
chSysUnlockFromISR();
|
||||
while (r--)
|
||||
x++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -227,7 +241,7 @@ void vt_storm_execute(const vt_storm_config_t *cfg) {
|
|||
palToggleLine(config->line);
|
||||
chprintf(cfg->out, ".");
|
||||
delay--;
|
||||
} while (delay >= 10);
|
||||
} while (delay >= 5);
|
||||
|
||||
if (saturated) {
|
||||
chprintf(cfg->out, "\r\nSaturated at %u uS", TIME_I2US(delay));
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* @brief Timings randomization.
|
||||
*/
|
||||
#if !defined(VT_STORM_CFG_RANDOMIZE) || defined(__DOXYGEN__)
|
||||
#define VT_STORM_CFG_RANDOMIZE FALSE
|
||||
#define VT_STORM_CFG_RANDOMIZE TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue