|
32 | 32 | from ximea import xiapi |
33 | 33 |
|
34 | 34 |
|
| 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 | + |
35 | 58 | @Pyro4.expose |
36 | 59 | @Pyro4.behavior('single') |
37 | 60 | class XimaeCamera(devices.CameraDevice): |
@@ -120,9 +143,30 @@ def get_cycle_time(self): |
120 | 143 | def _get_sensor_shape(self): |
121 | 144 | return (self.img.width,self.image.height) |
122 | 145 |
|
| 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 | + |
123 | 157 | def get_trigger_type(self): |
| 158 | + trig=self.handle.get_trigger_source() |
124 | 159 | return devices.TRIGGER_SOFT |
125 | 160 |
|
| 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 | + |
126 | 170 | def soft_trigger(self): |
127 | 171 | self._logger.info('Trigger received; self._acquiring is %s.' |
128 | 172 | % self._acquiring) |
|
0 commit comments