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

implement wait for trigger

parent 24520dae
...@@ -56,7 +56,7 @@ function td = getdurations(block) ...@@ -56,7 +56,7 @@ function td = getdurations(block)
stimarr(end+1) = block(bidx).trial(tidx).stim(end).offdelay; stimarr(end+1) = block(bidx).trial(tidx).stim(end).offdelay;
end end
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 end
......
...@@ -18,8 +18,12 @@ function cfg = pb_vClearTrial(stim, cfg) ...@@ -18,8 +18,12 @@ function cfg = pb_vClearTrial(stim, cfg)
stim(iStm).ledhandle.delete; % delete(leds)/switch off light; stim(iStm).ledhandle.delete; % delete(leds)/switch off light;
end end
end end
if isfield(stim(iStm),'ledhandle')
end
end end
%% Turn off sounds %% Turn off sounds
for muxIdx = 1:4 for muxIdx = 1:4
......
function pb_vRunTrial(zbus, trialdur) function pb_vRunTrial(zbus, cfg)
% PB_VRUNTRIAL(HANDLES) % PB_VRUNTRIAL(HANDLES)
% %
% PB_VRUNTRIAL(HANDLES) ... % PB_VRUNTRIAL(HANDLES) ...
...@@ -13,7 +13,10 @@ function pb_vRunTrial(zbus, trialdur) ...@@ -13,7 +13,10 @@ function pb_vRunTrial(zbus, trialdur)
%% Trigger event 1 %% Trigger event 1
zbus.zBusTrigB(0, 0, 2); % start event 1/trial onset; trigger zBus 4 = RA16; 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 while toc(t) < trialdur
pause(0.05); pause(0.05);
end end
......
...@@ -11,6 +11,7 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg) ...@@ -11,6 +11,7 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
%% SET TDT PARAMETERS %% SET TDT PARAMETERS
selled = strcmpi({stim.modality},'LED'); selled = strcmpi({stim.modality},'LED');
selsnd = strcmpi({stim.modality},'sound'); selsnd = strcmpi({stim.modality},'sound');
seltrg = strcmpi({stim.modality},'TRG0');
%% LED %% LED
if any(selled) if any(selled)
...@@ -66,6 +67,10 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg) ...@@ -66,6 +67,10 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
end end
cfg.maxSamples = 0; cfg.maxSamples = 0;
%% TRIGGER
cfg.trig = any(seltrg);
%% WAIT %% 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