-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitlpt.m
More file actions
55 lines (53 loc) · 1.42 KB
/
initlpt.m
File metadata and controls
55 lines (53 loc) · 1.42 KB
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
50
51
52
53
54
55
function [ status, LPT ] = initlpt( varargin )
%initlpt Init LPT port
% Default is running serial mode
% Status code
% 1 - could not be initialized
fprintf('\n\n');
fprintf('Initialising LPT port...\n')
% default LPT is a running serial mode
isDummy = 0;
isParallel = 0;
if nargin > 0
for i=1:length(varargin)
switch varargin{i}
case 'dummy'
isDummy = 1;
case 'parallel'
isParallel = 1;
end
end
end
% Init parallel port
if all([isDummy, isParallel])
LPT = LPTController('dummy', 'parallel');
fprintf('LPT port in a dummy mode...\n')
fprintf('LPT port running parallel...\n')
status = 0;
elseif isDummy
LPT = LPTController('dummy');
fprintf('LPT port in a dummy mode...\n')
fprintf('LPT port running serial...\n')
status = 0;
elseif isParallel
LPT = LPTController('parallel');
if LPT.isEnabled
fprintf('LPT port initialised...\n')
fprintf('LPT port running parallel...\n')
status = 0;
else
fprintf('LPT could not be initialised...\n')
status = 1;
end
else
LPT = LPTController();
if LPT.isEnabled
fprintf('LPT port initialised...\n')
fprintf('LPT port running serial...\n')
status = 0;
else
fprintf('LPT could not be initialised...\n')
status = 1;
end
end
end