Add encoder indexing support in C++

Java will be done tonight or tomorrow

Change-Id: I3a3287a197b6f071c261172eb8ec930693e8b3c7
This commit is contained in:
Thomas Clark
2015-01-06 16:39:24 -05:00
parent 87e1df068c
commit a2dfffeddc
5 changed files with 165 additions and 18 deletions

View File

@@ -1078,6 +1078,20 @@ uint32_t getEncoderSamplesToAverage(void* encoder_pointer, int32_t *status) {
return encoder->encoder->readTimerConfig_AverageSize(status);
}
/**
* Set an index source for an encoder, which is an input that resets the
* encoder's count.
*/
void setEncoderIndexSource(void *encoder_pointer, uint32_t pin, bool analogTrigger, bool activeHigh,
bool edgeSensitive, int32_t *status) {
Encoder* encoder = (Encoder*) encoder_pointer;
encoder->encoder->writeConfig_IndexSource_Channel((unsigned char)pin, status);
encoder->encoder->writeConfig_IndexSource_Module((unsigned char)0, status);
encoder->encoder->writeConfig_IndexSource_AnalogTrigger(analogTrigger, status);
encoder->encoder->writeConfig_IndexActiveHigh(activeHigh, status);
encoder->encoder->writeConfig_IndexEdgeSensitive(edgeSensitive, status);
}
/**
* Get the loop timing of the PWM system
*