Commit 6f69f5bc authored by Jesse Heckman's avatar Jesse Heckman

implement wait for trigger

parent 24520dae
......@@ -56,7 +56,7 @@ function td = getdurations(block)
stimarr(end+1) = block(bidx).trial(tidx).stim(end).offdelay;
end
end
td = ceil(max(stimarr)/500)/2; % rounds up max trial duration with .5 precision
td = ceil(max(stimarr)/500)/2; % rounds up max trial duration with .5 precision
end
......
......@@ -18,8 +18,12 @@ function cfg = pb_vClearTrial(stim, cfg)
stim(iStm).ledhandle.delete; % delete(leds)/switch off light;
end
end
if isfield(stim(iStm),'ledhandle')
end
end
%% Turn off sounds
for muxIdx = 1:4
......
function pb_vRunTrial(zbus, trialdur)
function pb_vRunTrial(zbus, cfg)
% PB_VRUNTRIAL(HANDLES)
%
% PB_VRUNTRIAL(HANDLES) ...
......@@ -13,7 +13,10 @@ function pb_vRunTrial(zbus, trialdur)
%% Trigger event 1
zbus.zBusTrigB(0, 0, 2); % start event 1/trial onset; trigger zBus 4 = RA16;
t = tic;
t = tic;
trialdur = cfg.trialdur;
if cfg.trig; trialdur = 10; end
while toc(t) < trialdur
pause(0.05);
end
......
......@@ -11,6 +11,7 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
%% SET TDT PARAMETERS
selled = strcmpi({stim.modality},'LED');
selsnd = strcmpi({stim.modality},'sound');
seltrg = strcmpi({stim.modality},'TRG0');
%% LED
if any(selled)
......@@ -66,6 +67,10 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
end
cfg.maxSamples = 0;
%% TRIGGER
cfg.trig = any(seltrg);
%% WAIT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment