Skip to content

Commit da92305

Browse files
committed
- Removed support for state machine communication via PsychToolbox IOPort (though support is retained in ArCOM for user code). IOPort was not used on r2019b, which is now the minimum version supported.
1 parent 4241670 commit da92305

File tree

3 files changed

+14
-39
lines changed

3 files changed

+14
-39
lines changed

Bpod.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
% It is necessary to connect separate instances of MATLAB to separate machines.
2929
% Note: To launch directly into emulator mode, use port name EMU.
3030
%
31-
% Java: On MATLAB pre-r2019a, adding a second argument 'Java' forces usage
32-
% of MATLAB's legacy Java serial interface, even with PsychToolbox installed.
33-
%
3431
% Example usage
3532
% Bpod(); % Start Bpod and auto-detect the state machine serial port
3633
% Bpod('COM3'); % Start Bpod with a state machine on port COM3
@@ -86,12 +83,7 @@ function Bpod(varargin)
8683
if strcmp(varargin{1}, 'EMU')
8784
emulator_setup;
8885
else
89-
if nargin > 1
90-
forceJava = varargin{2};
91-
BpodSystem.Connect2BpodSM(varargin{1}, forceJava);
92-
else
93-
BpodSystem.Connect2BpodSM(varargin{1});
94-
end
86+
BpodSystem.Connect2BpodSM(varargin{1});
9587
bpod_setup;
9688
end
9789
else

Functions/@BpodObject/Connect2BpodSM.m

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
% portString: the name of the USB serial port as known to the operating system.
2626
% On Windows this looks like 'COM3' and on Linux '/dev/ttyACM0'
2727
% use 'AUTO' to auto-discover the Bpod State Machine's port
28-
% forceJava: (optional, char array) if supplied, Bpod uses MATLAB's native
29-
% serial interface instead of PsychToolbox IOPort if installed
28+
% forceJava: (optional, char array) depricated argument that forced use of MATLAB's
29+
% built-in serial interface if Psychtoolbox IOPort was installed. IOPort is
30+
% no longer supported so the forceJava argument is ignored if provided by the user.
3031

3132
function obj = Connect2BpodSM(obj, portString, varargin)
3233

@@ -52,27 +53,15 @@
5253
portsTried = [];
5354
found = 0;
5455
iPort = 1;
55-
if nargin > 2
56-
forceJava = 1;
57-
else
58-
forceJava = 0;
59-
end
56+
forceJava = 0;
6057
while (found == 0) && (iPort <= nPorts)
6158
thisPort = Ports{iPort};
6259
portsTried = [portsTried thisPort ' '];
6360
connected = 0;
64-
if forceJava
65-
try
66-
obj.SerialPort = ArCOMObject_Bpod(thisPort, 12000000, 'Java');
67-
connected = 1;
68-
catch
69-
end
70-
else
71-
try
72-
obj.SerialPort = ArCOMObject_Bpod(thisPort, 12000000);
73-
connected = 1;
74-
catch
75-
end
61+
try
62+
obj.SerialPort = ArCOMObject_Bpod(thisPort, 12000000);
63+
connected = 1;
64+
catch
7665
end
7766
if connected
7867
if skipDiscovery
@@ -131,15 +120,6 @@
131120
end
132121
end
133122

134-
% For MATLAB predating the builtin serialport() class (2019b), recommend PsychToolbox
135-
if obj.SerialPort.UsePsychToolbox == 0 && verLessThan('matlab', '9.7')
136-
disp('###########################################################################')
137-
disp('# NOTICE: Bpod is running without Psychtoolbox installed. #')
138-
disp('# PsychToolbox integration greatly improves USB transfer speed + latency. #')
139-
disp('# See http://psychtoolbox.org/download.html for installation instructions.#')
140-
disp('###########################################################################')
141-
end
142-
143123
% Finish setup
144124
% obj.SystemSettings.LastCOMPort = Ports{thisPortIndex};
145125
% obj.SaveSettings;

Functions/Internal Functions/ArCOM/ArCOMObject_Bpod.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
% To avoid time-costly arg parsing, all arguments must be provided, up to the highest one needed.
3737
% baudRate is in bps. This is ignored for microcontrollers with native USB support
3838
% (e.g. 32-bit Arduino, Teensy 3.X-4.X).
39-
% Interface can be either [], 'Java', 'PsychToolbox'. [] defaults to Java for r2019b or newer,
39+
% Interface can be either [], 'Builtin' or 'PsychToolbox'. [] defaults to Builtin for r2019b or newer,
4040
% and Psychtoolbox on older versions.
4141
% TCPPort can be [], or a port on a remote computer if using the Ethernet interface.
4242
% InputBufferSize and OutputBufferSize must be in range 0-10M bytes
@@ -104,7 +104,10 @@
104104
if nargin > 2
105105
if ~isempty(varargin{2})
106106
switch lower(varargin{2})
107-
case 'java'
107+
case 'builtin'
108+
obj.UsePsychToolbox = 0;
109+
obj.Interface = 0;
110+
case 'java' % For compatibility with old code
108111
obj.UsePsychToolbox = 0;
109112
obj.Interface = 0;
110113
case 'psychtoolbox'

0 commit comments

Comments
 (0)