Add methods to retreive the FPGA index for counters and encoders and return the encoding type as an integer

Change-Id: Iaa4062ec124b968b27e7c812cc754032fcb354d2

Add methods to retrieve the FPGA index for counters and encoders and return the encoding type as an integer

Change-Id: If04dc291f39a9b331495d2b97a8b87d3ded71280
This commit is contained in:
Brad Miller
2014-12-30 17:36:12 -05:00
parent b94341a23e
commit fb7f5e9de8
9 changed files with 89 additions and 10 deletions

View File

@@ -28,6 +28,9 @@ void Encoder::InitEncoder(int channelA, int channelB, bool reverseDirection, Enc
this->channelA = channelA;
this->channelB = channelB;
m_encodingType = encodingType;
m_encodingScale = encodingType == k4X ? 4
: encodingType == k2X ? 2
: 1;
int32_t index = 0;
m_distancePerPulse = 1.0;
@@ -188,6 +191,12 @@ double Encoder::DecodingScaleFactor()
}
}
/**
* The encoding scale factor 1x, 2x, or 4x, per the requested encodingType.
* Used to divide raw edge counts down to spec'd counts.
*/
int32_t Encoder::GetEncodingScale() { return m_encodingScale; }
/**
* Gets the raw value from the encoder.
* The raw value is the actual count unscaled by the 1x, 2x, or 4x scale