/usr/share/psychtoolbox-3/PsychHardware/Daq/DaqWaitButtonDumbTest1408FS.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | % DaqWaitButtonDumbTest1408FS.m
%
% A quick and dirty demo on how to poll the digital inputs
% of a USB-1408FS as fast as possible, without overhead.
%
% This is essentially a stripped down version of DaqDIn() with
% some polling loops wrapped around and a options.secs value of
% zero for essentially polling with no timeout.
%
daq = DaqFind;
reportId = 3;
TheReport = uint8(0);
NumberOfPorts = 2;
if IsWin
% Windows needs some minimal polling time:
options.secs = 0.001;
else
options.secs = 0.000;
end
PsychHID('ReceiveReportsStop',daq);
PsychHID('GiveMeReports',daq);
PsychHID('ReceiveReports',daq, options);
while 1
% Emit query to device:
PsychHID('SetReport',daq,2,reportId, TheReport);
% Wait for result from device:
inreport = [];
while isempty(inreport)
% Yield some minimum amount of time to other processes if you want to be
WaitSecs('YieldSecs', 0);
% New data available?
inreport = PsychHID('GetReport',daq,1,reportId,NumberOfPorts+1);
end
% inreport contains latest button query result: Button pressed?
if inreport(3) ~= 255
% yes: Done!
break;
end
% No. Repeat sampling...
end
fprintf('Change detected! Bye.\n');
|