7 dT = ctx->digitalFrames/ctx->digitalSampleRate;
14 bool Leds::processLed(Led _led) {
15 int ledno = (int) _led;
16 LedState ledstate = _ledstate[ledno];
27 float bp = _blinkPeriod[ledno];
28 float *time = &(_timer[ledno]);
29 float dc = _blinkDutyCycle[ledno];
30 if(*time > bp) {(*time) -= bp;}
31 state = (*time < dc*bp) ?
true :
false;
39 float bp = _blinkPeriod[ledno];
40 float *time = &(_timer[ledno]);
41 state = (*time < bp) ?
true :
false;
44 _ledstate[ledno] = off;
59 _on[(int) wrist] = processLed(wrist);
60 _on[(int) thumb] = processLed(thumb);
61 _on[(int) vibrator] = processLed(vibrator);
62 _on[(int) controlbox] = processLed(controlbox);
74 digitalWrite(ctx, frameno,
VIBRATOR_PIN, _on[(
int) vibrator]);
81 _ledstate[(int) led] = ledstate;
82 _timer[(int) led] = 0.0f;
83 _blinkPeriod[(int) led] = period;
84 _blinkDutyCycle[(int) led] = dutycycle;