-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathJaneliaLeicaController.m
More file actions
114 lines (79 loc) · 2.86 KB
/
Copy pathJaneliaLeicaController.m
File metadata and controls
114 lines (79 loc) · 2.86 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
classdef JaneliaLeicaController < cutter & loghandler
% Interface for Janelia controller for Leica vibratome.
%
% For more information on the cutter, see the abstract class.
%
% Rob Campbell - Basel, 2017
% NOTE -- this class is not tested!
properties
end %close public properties
methods
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Constructor
function obj = JaneliaLeicaController(deviceName,logObject)
%Attach log object if it is supplied
if nargin>1
obj.attachLogObject(logObject);
end
fprintf('Setting up Janelia Leica Controller.\n')
obj.controllerID=deviceName;
success = obj.connect;
if ~success
fprintf('Component JaneliaLeicaController failed to connect to vibrotome controller.\n')
end
end % Constructor
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Destructor
function delete(obj)
if ~isempty(obj.hC)
obj.stopVibrate;
delete(obj.hC);
end
end % Destructor
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function success = connect(obj)
success=false;
if isempty(obj.controllerID)
fprintf('Can not connect to JaneliaLeicaController. No controller ID defined.\n')
return
end
try
obj.hC = dabs.no.daqmx.Task.empty;
obj.hC = dabs.ni.daqmx.Task('cutter');
obj.hC.createDOChan(obj.controllerID,'port0/line0');
success=true;
obj.isCutterConnected=success;
catch
fprintf('Failed to connect to DAQ for JaneliaLeicaController.\n')
end
end %connect
function success = isControllerConnected(obj)
success = obj.isControllerConnected;
end %isControllerConnected
function success = enable(obj)
success=true;
end %enable
function success = disable(obj)
success=false;
end %disable
function success = startVibrate(obj,~)
try
obj.hC.writeDigitalData(1);
success = true;
catch
success = false;
end
end %startVibrate
function success = stopVibrate(obj,~)
try
obj.hC.writeDigitalData(0);
success = true;
catch
success = false;
end
end %stopVibrate
function cyclesPerSec = readVibrationSpeed(obj)
cyclesPerSec=false;
end %readVibrationSpeed
end %close methods
end % close class def