summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cameras/uca_pco.c18
-rw-r--r--src/uca.c10
-rw-r--r--src/uca.h41
3 files changed, 61 insertions, 8 deletions
diff --git a/src/cameras/uca_pco.c b/src/cameras/uca_pco.c
index fd63139..413d389 100644
--- a/src/cameras/uca_pco.c
+++ b/src/cameras/uca_pco.c
@@ -62,7 +62,6 @@ uint32_t uca_pco_init(struct uca_t *uca)
{
uca->user = (struct pco_cam_t *) malloc(sizeof(struct pco_cam_t));
-
struct pco_cam_t *pco_cam = uca->user;
struct pco_edge_t *pco = pco_cam->pco = pco_init();
@@ -86,11 +85,26 @@ uint32_t uca_pco_init(struct uca_t *uca)
/* ... and some properties */
pco_get_actual_size(pco, &uca->image_width, &uca->image_height);
- /* Prepare camera for recording. */
+ /* Prepare camera for recording */
pco_set_rec_state(pco, 0);
pco_set_timestamp_mode(pco, 2);
pco_set_timebase(pco, 1, 1);
pco_arm_camera(pco);
+ /* Prepare frame grabber for recording */
+ int val = FG_CL_8BIT_FULL_10;
+ Fg_setParameter(fg, FG_CAMERA_LINK_CAMTYP, &val, PORT_A);
+
+ val = FG_GRAY;
+ Fg_setParameter(fg, FG_FORMAT, &val, PORT_A);
+
+ val = FREE_RUN;
+ Fg_setParameter(fg, FG_TRIGGERMODE, &val, PORT_A);
+
+ Fg_setParameter(fg, FG_WIDTH, &uca->image_width, PORT_A);
+ Fg_setParameter(fg, FG_HEIGHT, &uca->image_height, PORT_A);
+
+ pco_set_rec_state(pco, 1);
+
return 0;
}
diff --git a/src/uca.c b/src/uca.c
index af934c8..facccb4 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -30,6 +30,14 @@ struct uca_t *uca_init()
#endif
NULL };
+ /* Set all function pointers to NULL and thus make the class abstract */
+ uca->cam_destroy = NULL;
+ uca->cam_set_dimensions = NULL;
+ uca->cam_set_bitdepth = NULL;
+ uca->cam_set_delay = NULL;
+ uca->cam_set_exposure = NULL;
+ uca->cam_acquire_image = NULL;
+
int i = 0;
while (inits[i] != NULL) {
uca_cam_init init = inits[i];
@@ -38,7 +46,7 @@ struct uca_t *uca_init()
i++;
}
- /* No camera found then return nothing */
+ /* No camera found then indicate error */
free(uca);
return NULL;
}
diff --git a/src/uca.h b/src/uca.h
index 0f3261e..bf0c249 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -1,42 +1,73 @@
#ifndef __UNIFIED_CAMERA_ACCESS_H
#define __UNIFIED_CAMERA_ACCESS_H
+/**
+ * \file uca.h
+ * \brief Abstract camera model
+ *
+ * The uca_t structure represents a common interface for cameras regardless of
+ * their connectivity. Each camera that adheres to this model must provide an
+ * initialization function that probes the device and sets all function pointers
+ * to their respective implementation.
+ */
+
#include <stdint.h>
struct uca_t;
-/*
+/**
* \brief Camera probing and initialization
- * \return 0 if camera is not found or could not be initialized
+ * \return UCA_ERR_INIT_NOT_FOUND if camera is not found or could not be initialized
*/
typedef uint32_t (*uca_cam_init) (struct uca_t *uca);
+/**
+ * \brief Free camera resouces
+ */
typedef uint32_t (*uca_cam_destroy) (struct uca_t *uca);
+/**
+ * \brief Set dimension of grabbed images
+ * \param[in] width Width of the image
+ * \param[in] height Height of the image
+ * \note input parameters might be changed if dimensions couldn't be set
+ */
typedef uint32_t (*uca_cam_set_dimensions) (struct uca_t *uca, uint32_t *width, uint32_t *height);
+/**
+ * \brief Set bitdepth of grabbed images
+ */
typedef uint32_t (*uca_cam_set_bitdepth) (struct uca_t *uca, uint8_t *bitdepth);
+/**
+ * \brief Set exposure time in milliseconds
+ */
typedef uint32_t (*uca_cam_set_exposure) (struct uca_t *uca, uint32_t *exposure);
+/**
+ * \brief Set delay time in milliseconds
+ */
typedef uint32_t (*uca_cam_set_delay) (struct uca_t *uca, uint32_t *delay);
+/**
+ * \brief Acquire one frame
+ */
typedef uint32_t (*uca_cam_acquire_image) (struct uca_t *uca, void *buffer);
+#define UCA_NO_ERROR 0
-#define UCA_ERR_INIT_NOT_FOUND 1 /**< camera probing failed */
+#define UCA_ERR_INIT_NOT_FOUND 1 /**< camera probing or initialization failed */
#define UCA_ERR_DIMENSION_NOT_SUPPORTED 1
#define UCA_ERR_BITDEPTH_NOT_SUPPORTED 1
-
#define UCA_BIG_ENDIAN 1
#define UCA_LITTLE_ENDIAN 2
struct uca_t {
- /* These must be written by uca_cam_init() */
+ /* These must be set by uca_*_init() */
unsigned int image_width;
unsigned int image_height;
unsigned int image_bitdepth;