diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-04-18 10:59:11 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-04-18 10:59:11 +0200 |
commit | fcffc9f40c32c863b85cbee3e7d6f51b5b6cdc41 (patch) | |
tree | c3cde2be2da7b19acae6a8cc48edddcd696af510 /src/cameras | |
parent | ecb5c3617140852dbd57cc3a77a5fe3dfaf2ed6f (diff) | |
download | uca-fcffc9f40c32c863b85cbee3e7d6f51b5b6cdc41.tar.gz uca-fcffc9f40c32c863b85cbee3e7d6f51b5b6cdc41.tar.bz2 uca-fcffc9f40c32c863b85cbee3e7d6f51b5b6cdc41.tar.xz uca-fcffc9f40c32c863b85cbee3e7d6f51b5b6cdc41.zip |
Implement correct trigger modes
Diffstat (limited to 'src/cameras')
-rw-r--r-- | src/cameras/dummy.c | 6 | ||||
-rw-r--r-- | src/cameras/pco.c | 16 | ||||
-rw-r--r-- | src/cameras/pf.c | 6 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c index 58aa591..2bb0400 100644 --- a/src/cameras/dummy.c +++ b/src/cameras/dummy.c @@ -281,6 +281,11 @@ static uint32_t uca_dummy_destroy(struct uca_camera *cam) return UCA_NO_ERROR; } +static uint32_t uca_dummy_ignore(struct uca_camera *cam) +{ + return UCA_NO_ERROR; +} + uint32_t uca_dummy_init(struct uca_camera **cam, struct uca_grabber *grabber) { struct uca_camera *uca = uca_cam_new(); @@ -290,6 +295,7 @@ uint32_t uca_dummy_init(struct uca_camera **cam, struct uca_grabber *grabber) uca->get_property = &uca_dummy_get_property; uca->start_recording = &uca_dummy_start_recording; uca->stop_recording = &uca_dummy_stop_recording; + uca->trigger = &uca_dummy_ignore; uca->grab = &uca_dummy_grab; uca->register_callback = &uca_dummy_register_callback; diff --git a/src/cameras/pco.c b/src/cameras/pco.c index b3ff872..6c4f93f 100644 --- a/src/cameras/pco.c +++ b/src/cameras/pco.c @@ -69,6 +69,7 @@ static uint32_t uca_pco_set_property(struct uca_camera *cam, enum uca_property_i if (pco_set_roi(pco_d->pco, pco_d->roi) != PCO_NOERROR) return err | UCA_ERR_OUT_OF_RANGE; + /* Twice the width because of 16 bits per pixel */ uint32_t w = cam->frame_width * 2; grabber->set_property(grabber, UCA_PROP_WIDTH, &w); break; @@ -232,6 +233,7 @@ static uint32_t uca_pco_start_recording(struct uca_camera *cam) return err | UCA_ERR_UNCLASSIFIED; if (pco_set_rec_state(pco, 1) != PCO_NOERROR) return err | UCA_ERR_UNCLASSIFIED; + cam->state = UCA_CAM_RECORDING; return cam->grabber->acquire(cam->grabber, -1); } @@ -239,9 +241,18 @@ static uint32_t uca_pco_stop_recording(struct uca_camera *cam) { if (pco_set_rec_state(GET_PCO(cam), 0) != PCO_NOERROR) return UCA_ERR_CAMERA | UCA_ERR_INIT | UCA_ERR_UNCLASSIFIED; + cam->state = UCA_CAM_ARMED; return UCA_NO_ERROR; } +static uint32_t uca_pco_trigger(struct uca_camera *cam) +{ + if (cam->state != UCA_CAM_RECORDING) + return UCA_ERR_CAMERA | UCA_ERR_TRIGGER | UCA_ERR_NOT_RECORDING; + + return cam->grabber->trigger(cam->grabber); +} + static uint32_t uca_pco_grab(struct uca_camera *cam, char *buffer, void *meta_data) { uint16_t *frame; @@ -288,13 +299,14 @@ uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber) uca->get_property = &uca_pco_get_property; uca->start_recording = &uca_pco_start_recording; uca->stop_recording = &uca_pco_stop_recording; + uca->trigger = &uca_pco_trigger; uca->grab = &uca_pco_grab; uca->register_callback = &uca_pco_register_callback; /* Prepare camera for recording */ pco_set_scan_mode(pco, PCO_SCANMODE_SLOW); pco_set_rec_state(pco, 0); - pco_set_timestamp_mode(pco, 2); + pco_set_timestamp_mode(pco, UCA_TIMESTAMP_ASCII); pco_set_timebase(pco, 1, 1); pco_arm_camera(pco); @@ -305,7 +317,7 @@ uint32_t uca_pco_init(struct uca_camera **cam, struct uca_grabber *grabber) val = UCA_FORMAT_GRAY8; grabber->set_property(grabber, UCA_GRABBER_FORMAT, &val); - val = UCA_TRIGGER_FREERUN; + val = UCA_TRIGGER_AUTO; grabber->set_property(grabber, UCA_GRABBER_TRIGGER_MODE, &val); uint32_t width, height; diff --git a/src/cameras/pf.c b/src/cameras/pf.c index b787f5c..aa05df6 100644 --- a/src/cameras/pf.c +++ b/src/cameras/pf.c @@ -171,6 +171,11 @@ static uint32_t uca_pf_stop_recording(struct uca_camera *cam) return cam->grabber->stop_acquire(cam->grabber); } +static uint32_t uca_pf_trigger(struct uca_camera *cam) +{ + return cam->grabber->trigger(cam->grabber); +} + static uint32_t uca_pf_grab(struct uca_camera *cam, char *buffer, void *metadata) { uint16_t *frame; @@ -217,6 +222,7 @@ uint32_t uca_pf_init(struct uca_camera **cam, struct uca_grabber *grabber) uca->get_property = &uca_pf_get_property; uca->start_recording = &uca_pf_start_recording; uca->stop_recording = &uca_pf_stop_recording; + uca->trigger = &uca_pf_trigger; uca->grab = &uca_pf_grab; uca->register_callback = &uca_pf_register_callback; |