/***************************************************************
 * PrAccelSensorJr3PCI.cpp
 *
 * Implementation of JR3 accel sensor functionality that is
 * specific to the PCI version.  Programming the JR3 is identical
 * whether you're using it for force or acceleration sensing, just
 * that you plug into a different channel (and the DSP code is
 * uploaded to the upper 512Kb portion of device memory).  For this
 * reason, this implementation merely uses PrForceSensorJr3 
 *
 ****************************************************************/
#include "PrAccelSensorJr3PCI.h"

PrAccelSensorJr3PCI::PrAccelSensorJr3PCI() : PrAccelSensorJr3() {
    fs = new PrForceSensorJr3PCI( PrForceSensorJr3PCI::ACCEL_SENSOR );
    flag( fs->flag() );
}

int
PrAccelSensorJr3PCI::values( Float * data ) {
    return fs->values( data );
}

int
PrAccelSensorJr3PCI::value( int channel, Float & data ) {
    return fs->value( channel, data );
}

PrAccelSensorJr3::AccelArray
PrAccelSensorJr3PCI::getAccel( int filterNum ) {
    PrForceSensorJr3::ForceArray forceArray = fs->getForces( filterNum );
    AccelArray accelArray;
    for ( int i = 0; i < 6; i++ )
        accelArray.axis[i] = forceArray.axis[i];
    accelArray.v1 = forceArray.v1;
    accelArray.v2 = forceArray.v2;

    return accelArray;
}

PrAccelSensorJr3::AccelArray
PrAccelSensorJr3PCI::getDerivativeAccel( int filterNum ) {
    PrForceSensorJr3::ForceArray forceArray = 
        fs->getDerivativeForces( filterNum );
    AccelArray accelArray;
    for ( int i = 0; i < 6; i++ )
        accelArray.axis[i] = forceArray.axis[i];
    accelArray.v1 = forceArray.v1;
    accelArray.v2 = forceArray.v2;

    return accelArray;
}

unsigned int
PrAccelSensorJr3PCI::getRateDivisor() {
    return fs->getRateDivisor();
}

void
PrAccelSensorJr3PCI::setRateDivisor( unsigned int divisor ) {
    fs->setRateDivisor( divisor );
}

unsigned int
PrAccelSensorJr3PCI::getErrorCount() {
    return fs->getErrorCount();
}

unsigned int
PrAccelSensorJr3PCI::getSaturationWarning() {
    return fs->getSaturationWarning();
}

unsigned int
PrAccelSensorJr3PCI::getErrorMessages() {
    return fs->getErrorMessages();
}

int
PrAccelSensorJr3PCI::zero() {
    return fs->zero();
}
