SyncPulse

Generates a single pulse after a rising edge on trigger input. The pulse-length depends on the time in-between triggers. The length-control sets the amount of the time in-between triggers that the pulse will be high.
Author: Remco van der Most
License: BSD
Github: sss/timer/SyncPulse.axo

Inlets

bool32.rising trigger

Outlets

bool32 pulse output

Parameters

frac32.u.map length

Declaration
uint32_t val;
int ntrig;
uint32_t timer;
Init
val = 0;
ntrig = 0;
Control Rate
val += 1;
if ((inlet_trig > 0) && !ntrig) {
  ntrig = 1;
  timer = val;
  val = 0;
} else if (!(inlet_trig > 0)) {
  ntrig = 0;
}
outlet_out = (val < (___SMMUL(param_length << 3, timer << 2))) || (val < 1);

Privacy

© 2024 Zrna Research