Logo Search packages:      
Sourcecode: libdc1394-22 version File versions  Download package

dc1394error_t dc1394_feature_set_mode ( dc1394camera_t camera,
dc1394feature_t  feature,
dc1394feature_mode_t  mode 
)

Sets the current control modes for a feature

Definition at line 1498 of file control.c.

References dc1394_get_control_register(), and dc1394_set_control_register().

{
    dc1394error_t err;
    uint64_t offset;
    uint32_t curval;

    if ( (feature<DC1394_FEATURE_MIN) || (feature>DC1394_FEATURE_MAX) )
        return DC1394_INVALID_FEATURE;

    if ( (mode<DC1394_FEATURE_MODE_MIN) || (mode>DC1394_FEATURE_MODE_MAX) )
        return DC1394_INVALID_FEATURE_MODE;

    if (feature == DC1394_FEATURE_TRIGGER) {
        return DC1394_INVALID_FEATURE;
    }

    FEATURE_TO_VALUE_OFFSET(feature, offset);

    err=dc1394_get_control_register(camera, offset, &curval);
    DC1394_ERR_RTN(err, "Could not get feature register");

    if ((mode==DC1394_FEATURE_MODE_AUTO) && !(curval & 0x01000000UL)) {
        curval|= 0x01000000UL;
        err=dc1394_set_control_register(camera, offset, curval);
        DC1394_ERR_RTN(err, "Could not set auto mode for feature");
    }
    else if ((mode==DC1394_FEATURE_MODE_MANUAL) && (curval & 0x01000000UL)) {
        curval&= 0xFEFFFFFFUL;
        err=dc1394_set_control_register(camera, offset, curval);
        DC1394_ERR_RTN(err, "Could not set auto mode for feature");
    }
    else if ((mode==DC1394_FEATURE_MODE_ONE_PUSH_AUTO)&& !(curval & 0x04000000UL)) {
        curval|= 0x04000000UL;
        err=dc1394_set_control_register(camera, offset, curval);
        DC1394_ERR_RTN(err, "Could not sart one-push capability for feature");
    }

    return err;
}


Generated by  Doxygen 1.6.0   Back to index