summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/api.rst15
-rw-r--r--plugins/pco/uca-pco-camera.c22
-rw-r--r--plugins/ufo/uca-ufo-camera.c16
-rw-r--r--src/uca-camera.c54
-rw-r--r--src/uca-camera.h16
5 files changed, 78 insertions, 45 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 8d55b6a..cf0dd4b 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -58,21 +58,21 @@ automatically.
Triggering
----------
-``libuca`` supports three trigger modes through the "trigger-mode"
+``libuca`` supports three trigger sources through the "trigger-source"
property:
-1. ``UCA_CAMERA_TRIGGER_AUTO``: Exposure is triggered by the camera
+1. ``UCA_CAMERA_TRIGGER_SOURCE_AUTO``: Exposure is triggered by the camera
itself.
-2. ``UCA_CAMERA_TRIGGER_SOFTWARE``: Exposure is triggered via software.
-3. ``UCA_CAMERA_TRIGGER_EXTERNAL``: Exposure is triggered by an external
+2. ``UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE``: Exposure is triggered via software.
+3. ``UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL``: Exposure is triggered by an external
hardware mechanism.
-With ``UCA_CAMERA_TRIGGER_SOFTWARE`` you have to trigger with
+With ``UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE`` you have to trigger with
``uca_camera_trigger``::
/* thread A */
g_object_set (G_OBJECT (camera),
- "trigger-mode", UCA_CAMERA_TRIGGER_SOFTWARE,
+ "trigger-source", UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE,
NULL);
uca_camera_start_recording (camera, NULL);
@@ -82,6 +82,9 @@ With ``UCA_CAMERA_TRIGGER_SOFTWARE`` you have to trigger with
/* thread B */
uca_camera_trigger (camera, NULL);
+Moreover, the "trigger-type" property specifies if the exposure should be
+triggered at the rising edge or during the level signal.
+
Grabbing frames asynchronously
------------------------------
diff --git a/plugins/pco/uca-pco-camera.c b/plugins/pco/uca-pco-camera.c
index 2942ce9..4972b2c 100644
--- a/plugins/pco/uca-pco-camera.c
+++ b/plugins/pco/uca-pco-camera.c
@@ -154,7 +154,7 @@ static gint base_overrideables[] = {
PROP_SENSOR_VERTICAL_BINNINGS,
PROP_EXPOSURE_TIME,
PROP_FRAMES_PER_SECOND,
- PROP_TRIGGER_MODE,
+ PROP_TRIGGER_SOURCE,
PROP_ROI_X,
PROP_ROI_Y,
PROP_ROI_WIDTH,
@@ -913,18 +913,18 @@ uca_pco_camera_set_property(GObject *object, guint property_id, const GValue *va
}
break;
- case PROP_TRIGGER_MODE:
+ case PROP_TRIGGER_SOURCE:
{
- UcaCameraTrigger trigger_mode = (UcaCameraTrigger) g_value_get_enum(value);
+ UcaCameraTriggerSource trigger_source = g_value_get_enum (value);
- switch (trigger_mode) {
- case UCA_CAMERA_TRIGGER_AUTO:
+ switch (trigger_source) {
+ case UCA_CAMERA_TRIGGER_SOURCE_AUTO:
err = pco_set_trigger_mode(priv->pco, TRIGGER_MODE_AUTOTRIGGER);
break;
- case UCA_CAMERA_TRIGGER_SOFTWARE:
+ case UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE:
err = pco_set_trigger_mode(priv->pco, TRIGGER_MODE_SOFTWARETRIGGER);
break;
- case UCA_CAMERA_TRIGGER_EXTERNAL:
+ case UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL:
err = pco_set_trigger_mode(priv->pco, TRIGGER_MODE_EXTERNALTRIGGER);
break;
}
@@ -1240,20 +1240,20 @@ uca_pco_camera_get_property (GObject *object, guint property_id, GValue *value,
}
break;
- case PROP_TRIGGER_MODE:
+ case PROP_TRIGGER_SOURCE:
{
guint16 mode;
err = pco_get_trigger_mode(priv->pco, &mode);
switch (mode) {
case TRIGGER_MODE_AUTOTRIGGER:
- g_value_set_enum(value, UCA_CAMERA_TRIGGER_AUTO);
+ g_value_set_enum(value, UCA_CAMERA_TRIGGER_SOURCE_AUTO);
break;
case TRIGGER_MODE_SOFTWARETRIGGER:
- g_value_set_enum(value, UCA_CAMERA_TRIGGER_SOFTWARE);
+ g_value_set_enum(value, UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE);
break;
case TRIGGER_MODE_EXTERNALTRIGGER:
- g_value_set_enum(value, UCA_CAMERA_TRIGGER_EXTERNAL);
+ g_value_set_enum(value, UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL);
break;
default:
g_warning("pco trigger mode not handled");
diff --git a/plugins/ufo/uca-ufo-camera.c b/plugins/ufo/uca-ufo-camera.c
index 99a8c2f..1c0fd35 100644
--- a/plugins/ufo/uca-ufo-camera.c
+++ b/plugins/ufo/uca-ufo-camera.c
@@ -284,7 +284,7 @@ set_control_bit (UcaUfoCameraPrivate *priv, guint bit, gboolean set)
else
flags = flags & ~mask;
- err = pcilib_write_register(priv->handle, NULL, name, flags);
+ err = pcilib_write_register (priv->handle, NULL, name, flags);
PCILIB_WARN_ON_ERROR (err);
}
@@ -314,7 +314,7 @@ static void
uca_ufo_camera_start_recording(UcaCamera *camera, GError **error)
{
UcaUfoCameraPrivate *priv;
- UcaCameraTrigger trigger;
+ UcaCameraTriggerSource trigger_source;
gdouble exposure_time;
gboolean transfer_async;
@@ -325,11 +325,11 @@ uca_ufo_camera_start_recording(UcaCamera *camera, GError **error)
g_object_get (G_OBJECT(camera),
"transfer-asynchronously", &transfer_async,
"exposure-time", &exposure_time,
- "trigger-mode", &trigger,
+ "trigger-source", &trigger_source,
NULL);
- set_external_trigger_bit (priv, trigger == UCA_CAMERA_TRIGGER_EXTERNAL);
- set_streaming_bit (priv, trigger == UCA_CAMERA_TRIGGER_AUTO);
+ set_external_trigger_bit (priv, trigger == UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL);
+ set_streaming_bit (priv, trigger_mode == UCA_CAMERA_TRIGGER_SOURCE_AUTO);
priv->timeout = ((pcilib_timeout_t) (exposure_time * 1000 + 50.0) * 1000);
@@ -341,13 +341,13 @@ static void
uca_ufo_camera_stop_recording(UcaCamera *camera, GError **error)
{
UcaUfoCameraPrivate *priv;
- UcaCameraTrigger trigger;
+ UcaCameraTriggerSource trigger_source;
g_return_if_fail(UCA_IS_UFO_CAMERA(camera));
priv = UCA_UFO_CAMERA_GET_PRIVATE(camera);
set_external_trigger_bit (priv, FALSE);
- g_object_get (G_OBJECT (camera), "trigger-mode", &trigger, NULL);
+ g_object_get (G_OBJECT (camera), "trigger-source", &trigger_source, NULL);
if (priv->async_thread) {
int err = pcilib_stop(priv->handle, PCILIB_EVENT_FLAG_STOP_ONLY);
@@ -356,7 +356,7 @@ uca_ufo_camera_stop_recording(UcaCamera *camera, GError **error)
priv->async_thread = NULL;
}
- set_streaming_bit (priv, trigger != UCA_CAMERA_TRIGGER_AUTO);
+ set_streaming_bit (priv, trigger_mode != UCA_CAMERA_TRIGGER_SOURCE_AUTO);
}
static void
diff --git a/src/uca-camera.c b/src/uca-camera.c
index 66d7743..466d0df 100644
--- a/src/uca-camera.c
+++ b/src/uca-camera.c
@@ -41,14 +41,20 @@
G_DEFINE_TYPE(UcaCamera, uca_camera, G_TYPE_OBJECT)
/**
- * UcaCameraTrigger:
- * @UCA_CAMERA_TRIGGER_AUTO: Trigger automatically
- * @UCA_CAMERA_TRIGGER_EXTERNAL: Trigger from an external source
- * @UCA_CAMERA_TRIGGER_SOFTWARE: Trigger from software using
+ * UcaCameraTriggerSource:
+ * @UCA_CAMERA_TRIGGER_SOURCE_AUTO: Trigger automatically
+ * @UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL: Trigger from an external source
+ * @UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE: Trigger from software using
* #uca_camera_trigger
*/
/**
+ * UcaCameraTriggerType:
+ * @UCA_CAMERA_TRIGGER_TYPE_EDGE: Trigger on rising edge
+ * @UCA_CAMERA_TRIGGER_TYPE_LEVEL: Trigger during level signal
+ */
+
+/**
* UcaCameraError:
* @UCA_CAMERA_ERROR_NOT_FOUND: Camera type is unknown
* @UCA_CAMERA_ERROR_RECORDING: Camera is already recording
@@ -108,6 +114,7 @@ const gchar *uca_camera_props[N_BASE_PROPERTIES] = {
"sensor-horizontal-binnings",
"sensor-vertical-binning",
"sensor-vertical-binnings",
+ "trigger",
"trigger-mode",
"exposure-time",
"frames-per-second",
@@ -139,7 +146,8 @@ struct _UcaCameraPrivate {
guint num_buffers;
GThread *read_thread;
UcaRingBuffer *ring_buffer;
- UcaCameraTrigger trigger;
+ UcaCameraTriggerSource trigger_source;
+ UcaCameraTriggerType trigger_type;
GValueArray *h_binnings;
GValueArray *v_binnings;
};
@@ -180,8 +188,12 @@ uca_camera_set_property (GObject *object, guint property_id, const GValue *value
}
break;
- case PROP_TRIGGER_MODE:
- priv->trigger = g_value_get_enum (value);
+ case PROP_TRIGGER_SOURCE:
+ priv->trigger_source = g_value_get_enum (value);
+ break;
+
+ case PROP_TRIGGER_TYPE:
+ priv->trigger_type = g_value_get_enum (value);
break;
case PROP_BUFFERED:
@@ -215,8 +227,12 @@ uca_camera_get_property(GObject *object, guint property_id, GValue *value, GPara
g_value_set_boolean (value, priv->transfer_async);
break;
- case PROP_TRIGGER_MODE:
- g_value_set_enum (value, priv->trigger);
+ case PROP_TRIGGER_SOURCE:
+ g_value_set_enum (value, priv->trigger_source);
+ break;
+
+ case PROP_TRIGGER_TYPE:
+ g_value_set_enum (value, priv->trigger_type);
break;
case PROP_FRAMES_PER_SECOND:
@@ -423,11 +439,18 @@ uca_camera_class_init (UcaCameraClass *klass)
1, G_MAXUINT, 1,
G_PARAM_READABLE), G_PARAM_READABLE);
- camera_properties[PROP_TRIGGER_MODE] =
- g_param_spec_enum("trigger-mode",
- "Trigger mode",
- "Trigger mode",
- UCA_TYPE_CAMERA_TRIGGER, UCA_CAMERA_TRIGGER_AUTO,
+ camera_properties[PROP_TRIGGER_SOURCE] =
+ g_param_spec_enum("trigger-source",
+ "Trigger source",
+ "Trigger source",
+ UCA_TYPE_CAMERA_TRIGGER_SOURCE, UCA_CAMERA_TRIGGER_SOURCE_AUTO,
+ G_PARAM_READWRITE);
+
+ camera_properties[PROP_TRIGGER_TYPE] =
+ g_param_spec_enum("trigger-type",
+ "Trigger type",
+ "Trigger type",
+ UCA_TYPE_CAMERA_TRIGGER_TYPE, UCA_CAMERA_TRIGGER_TYPE_EDGE,
G_PARAM_READWRITE);
camera_properties[PROP_ROI_X] =
@@ -561,7 +584,8 @@ uca_camera_init (UcaCamera *camera)
camera->priv->is_recording = FALSE;
camera->priv->is_readout = FALSE;
camera->priv->transfer_async = FALSE;
- camera->priv->trigger = UCA_CAMERA_TRIGGER_AUTO;
+ camera->priv->trigger_source = UCA_CAMERA_TRIGGER_SOURCE_AUTO;
+ camera->priv->trigger_type = UCA_CAMERA_TRIGGER_TYPE_EDGE;
camera->priv->h_binnings = g_value_array_new (1);
camera->priv->v_binnings = g_value_array_new (1);
camera->priv->buffered = FALSE;
diff --git a/src/uca-camera.h b/src/uca-camera.h
index 0b6270c..97d3e6e 100644
--- a/src/uca-camera.h
+++ b/src/uca-camera.h
@@ -48,10 +48,15 @@ typedef enum {
} UcaCameraError;
typedef enum {
- UCA_CAMERA_TRIGGER_AUTO,
- UCA_CAMERA_TRIGGER_SOFTWARE,
- UCA_CAMERA_TRIGGER_EXTERNAL
-} UcaCameraTrigger;
+ UCA_CAMERA_TRIGGER_SOURCE_AUTO,
+ UCA_CAMERA_TRIGGER_SOURCE_SOFTWARE,
+ UCA_CAMERA_TRIGGER_SOURCE_EXTERNAL
+} UcaCameraTriggerSource;
+
+typedef enum {
+ UCA_CAMERA_TRIGGER_TYPE_EDGE,
+ UCA_CAMERA_TRIGGER_TYPE_LEVEL
+} UcaCameraTriggerType;
typedef enum {
UCA_UNIT_NA = 0,
@@ -78,7 +83,8 @@ enum {
PROP_SENSOR_HORIZONTAL_BINNINGS,
PROP_SENSOR_VERTICAL_BINNING,
PROP_SENSOR_VERTICAL_BINNINGS,
- PROP_TRIGGER_MODE,
+ PROP_TRIGGER_SOURCE,
+ PROP_TRIGGER_TYPE,
PROP_EXPOSURE_TIME,
PROP_FRAMES_PER_SECOND,
PROP_ROI_X,