Skip to content

Commit c4d5f3e

Browse files
Ian Dobbiemickp
authored andcommitted
1 parent fb701eb commit c4d5f3e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

microscope/cameras/ximea.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@
3232
from ximea import xiapi
3333

3434

35+
# Trigger mode to type.
36+
TRIGGER_MODES = {
37+
'internal': None,
38+
'external': devices.TRIGGER_BEFORE,
39+
'external start': None,
40+
'external exposure': devices.TRIGGER_DURATION,
41+
'software': devices.TRIGGER_SOFT,
42+
}
43+
44+
#trig types from define file....
45+
# #structure containing information about trigger source
46+
# XI_TRG_SOURCE = {
47+
# "XI_TRG_OFF": c_uint(0), #Camera works in free run mode.
48+
# "XI_TRG_EDGE_RISING": c_uint(1), #External trigger (rising edge).
49+
# "XI_TRG_EDGE_FALLING": c_uint(2), #External trigger (falling edge).
50+
# "XI_TRG_SOFTWARE": c_uint(3), #Software(manual) trigger.
51+
# "XI_TRG_LEVEL_HIGH": c_uint(4), #Specifies that the trigger is considered valid as long as the level of the source signal is high.
52+
# "XI_TRG_LEVEL_LOW": c_uint(5), #Specifies that the trigger is considered valid as long as the level of the source signal is low.
53+
# }
54+
55+
56+
57+
3558
@Pyro4.expose
3659
@Pyro4.behavior('single')
3760
class XimaeCamera(devices.CameraDevice):
@@ -120,9 +143,30 @@ def get_cycle_time(self):
120143
def _get_sensor_shape(self):
121144
return (self.img.width,self.image.height)
122145

146+
#trig types from define file....
147+
# #structure containing information about trigger source
148+
# XI_TRG_SOURCE = {
149+
# "XI_TRG_OFF": c_uint(0), #Camera works in free run mode.
150+
# "XI_TRG_EDGE_RISING": c_uint(1), #External trigger (rising edge).
151+
# "XI_TRG_EDGE_FALLING": c_uint(2), #External trigger (falling edge).
152+
# "XI_TRG_SOFTWARE": c_uint(3), #Software(manual) trigger.
153+
# "XI_TRG_LEVEL_HIGH": c_uint(4), #Specifies that the trigger is considered valid as long as the level of the source signal is high.
154+
# "XI_TRG_LEVEL_LOW": c_uint(5), #Specifies that the trigger is considered valid as long as the level of the source signal is low.
155+
# }
156+
123157
def get_trigger_type(self):
158+
trig=self.handle.get_trigger_source()
124159
return devices.TRIGGER_SOFT
125160

161+
def set_trigger_type(self, trigger):
162+
if (trigger == devices.TRIGGER_SOFT):
163+
self.handle.set_triger_source(XI_TG_SOURCE['Xi_TRG_SOFTWARE'])
164+
elif (trigger == devices.TRIGGER_BEFORE):
165+
self.handle.set_triger_source(XI_TG_SOURCE['Xi_TRG_EDGE_RISING'])
166+
#define digial input mode of trigger
167+
self.handle.set_gpi_selector(1)
168+
self.handle.set_gpi_mode(XI_GPI_TRIGGER)
169+
126170
def soft_trigger(self):
127171
self._logger.info('Trigger received; self._acquiring is %s.'
128172
% self._acquiring)

0 commit comments

Comments
 (0)