summaryrefslogtreecommitdiffstats
path: root/src/cameras/pco.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-10-20 17:25:53 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-10-20 17:25:53 +0200
commit7e1ec3056d1fdb6786c452ba6ed7e978355a98c2 (patch)
tree3e423903d8ad51c115db17f699e071a162447c24 /src/cameras/pco.c
parentf3fdc154a50516dc969942594e884cd0be0b29d0 (diff)
downloadlibuca-7e1ec3056d1fdb6786c452ba6ed7e978355a98c2.tar.gz
libuca-7e1ec3056d1fdb6786c452ba6ed7e978355a98c2.tar.bz2
libuca-7e1ec3056d1fdb6786c452ba6ed7e978355a98c2.tar.xz
libuca-7e1ec3056d1fdb6786c452ba6ed7e978355a98c2.zip
Add: auto transfer property and readout function
Diffstat (limited to 'src/cameras/pco.c')
-rw-r--r--src/cameras/pco.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/cameras/pco.c b/src/cameras/pco.c
index e7ef365..cfaa573 100644
--- a/src/cameras/pco.c
+++ b/src/cameras/pco.c
@@ -90,6 +90,9 @@ static uint32_t uca_pco_set_property(struct uca_camera_priv *cam, enum uca_prope
case UCA_PROP_DELAY:
return uca_pco_set_delay(cam, (uint32_t *) data);
+ case UCA_PROP_GRAB_AUTO:
+ return pco_set_auto_transfer(GET_PCO(cam), *(uint32_t *) data);
+
case UCA_PROP_TRIGGER_MODE:
/* XXX: We have a 1:1 mapping between UCA_TRIGGER_* and
* TRIGGER_MODE_*
@@ -224,6 +227,16 @@ static uint32_t uca_pco_get_property(struct uca_camera_priv *cam, enum uca_prope
uca_set_void(data, uint32_t, 16);
break;
+ case UCA_PROP_GRAB_AUTO:
+ {
+ int value = 0;
+ uint32_t err = pco_get_auto_transfer(pco, &value);
+ if (err != PCO_NOERROR)
+ return UCA_ERR_CAMERA | UCA_ERR_PROP | UCA_ERR_INVALID;
+ uca_set_void(data, uint32_t, value);
+ }
+ break;
+
case UCA_PROP_GRAB_TIMEOUT:
{
uint32_t timeout;
@@ -278,14 +291,26 @@ static uint32_t uca_pco_grab(struct uca_camera_priv *cam, char *buffer, void *me
return err;
if (GET_PCO_DESC(cam)->type == CAMERATYPE_PCO_EDGE)
- /* GET_PCO(cam)->reorder_image((uint16_t *) buffer, frame, cam->frame_width, cam->frame_height); */
- ;
+ pco_get_reorder_func(GET_PCO(cam))((uint16_t *) buffer, frame, cam->frame_width, cam->frame_height);
else
memcpy(buffer, (char *) frame, cam->frame_width * cam->frame_height * 2);
return UCA_NO_ERROR;
}
+static uint32_t uca_pco_readout(struct uca_camera_priv *cam)
+{
+ uint16_t active_segment;
+ uint32_t num_images = 0;
+ pco_handle pco = GET_PCO(cam);
+
+ /* TODO: error handling */
+ pco_get_active_segment(pco, &active_segment);
+ pco_get_num_images(pco, active_segment, &num_images);
+ pco_read_images(pco, active_segment, 1, num_images);
+ return UCA_NO_ERROR;
+}
+
static uint32_t uca_pco_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback callback, void *user)
{
if (cam->callback == NULL) {
@@ -330,6 +355,7 @@ uint32_t uca_pco_init(struct uca_camera_priv **cam, struct uca_grabber_priv *gra
uca->stop_recording = &uca_pco_stop_recording;
uca->trigger = &uca_pco_trigger;
uca->grab = &uca_pco_grab;
+ uca->readout = &uca_pco_readout;
uca->register_callback = &uca_pco_register_callback;
/* Prepare camera for recording */