Counter::Counter(AnalogTrigger &trigger) { InitCounter(); SetUpSource(trigger.CreateOutput(AnalogTriggerOutput::kState)); ClearDownSource(); m_allocatedUpSource = true; }
xCounter::xCounter(EncodingType encodingType, DigitalSource *upSource, DigitalSource *downSource, bool inverted) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL), m_encodingType(encodingType) { if (encodingType != k1X && encodingType != k2X) { wpi_setWPIErrorWithContext(ParameterOutOfRange, "Counter only supports 1X and 2X quadrature decoding."); return; } InitCounter(kExternalDirection); SetUpSource(upSource); SetDownSource(downSource); tRioStatusCode localStatus = NiFpga_Status_Success; if (encodingType == k1X) { SetUpSourceEdge(true, false); m_counter->writeTimerConfig_AverageSize(1, &localStatus); } else { SetUpSourceEdge(true, true); m_counter->writeTimerConfig_AverageSize(2, &localStatus); } wpi_setError(localStatus); SetDownSourceEdge(inverted, true); }
/** * Create an instance of a Counter object. * Create an up-Counter instance given a channel. The default digital module is assumed. */ Counter::Counter(UINT32 channel) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL) { InitCounter(); SetUpSource(channel); ClearDownSource(); }
/** * Create an instance of a Counter object. * Create an instance of an up-Counter given a digital module and a channel. * @param moduleNumber The digital module (1 or 2). * @param channel The channel in the digital module */ Counter::Counter(uint8_t moduleNumber, uint32_t channel) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL) { InitCounter(); SetUpSource(moduleNumber, channel); ClearDownSource(); }
Counter::Counter(DigitalSource &source) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL) { InitCounter(); SetUpSource(&source); ClearDownSource(); }
/** * Create an instance of a Counter object. * Create an instance of an up-Counter given a digital module and a channel. * @param moduleNumber The digital module (1 or 2). * @param channel The channel in the digital module */ Counter::Counter(UINT8 moduleNumber, UINT32 channel) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL) { InitCounter(); SetUpSource(moduleNumber, channel); ClearDownSource(); }
/** * Create an instance of a Counter object. * Create an instance of a simple up-Counter given an analog trigger. * Use the trigger state output from the analog trigger. */ Counter::Counter(AnalogTrigger *trigger) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL) { InitCounter(); SetUpSource(trigger->CreateOutput(AnalogTriggerOutput::kState)); ClearDownSource(); m_allocatedUpSource = true; }
xCounter::xCounter(DigitalSource &source) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL), m_encodingType(k1X) { InitCounter(); SetUpSource(&source); ClearDownSource(); }
/** * Create an instance of a Counter object. * Create an up-Counter instance given a channel. The default digital module is assumed. */ xCounter::xCounter(UINT32 channel) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL), m_encodingType(k1X) { InitCounter(); SetUpSource(channel); ClearDownSource(); }
xCounter::xCounter(AnalogTrigger &trigger) : m_upSource(NULL), m_downSource(NULL), m_counter(NULL), m_encodingType(k1X) { InitCounter(); SetUpSource(trigger.CreateOutput(AnalogTriggerOutput::kState)); ClearDownSource(); m_allocatedUpSource = true; }
Counter::Counter(EncodingType encodingType, DigitalSource *upSource, DigitalSource *downSource, bool inverted) { wpi_assert(encodingType == k1X || encodingType == k2X); InitCounter(kExternalDirection); SetUpSource(upSource); SetDownSource(downSource); if (encodingType == k1X) { SetUpSourceEdge(true, false); m_counter->writeTimerConfig_AverageSize(1, &status); } else { SetUpSourceEdge(true, true); m_counter->writeTimerConfig_AverageSize(2, &status); } SetDownSourceEdge(inverted, true); }
/** * Set the upsource for the counter as a digital input channel. * The slot will be the default digital module slot. */ void Counter::SetUpSource(UINT32 channel) { SetUpSource(GetDefaultDigitalModule(), channel); }
Counter::Counter(DigitalSource &source) { InitCounter(); SetUpSource(&source); ClearDownSource(); }
/** * Set the source object that causes the counter to count up. * Set the up counting DigitalSource. */ void xCounter::SetUpSource(DigitalSource &source) { SetUpSource(&source); }
/** * Set the up counting source to be an analog trigger. * @param analogTrigger The analog trigger object that is used for the Up Source * @param triggerType The analog trigger output that will trigger the counter. */ void xCounter::SetUpSource(AnalogTrigger &analogTrigger, AnalogTriggerOutput::Type triggerType) { SetUpSource(&analogTrigger, triggerType); }
/** * Set the up counting source to be an analog trigger. * @param analogTrigger The analog trigger object that is used for the Up Source * @param triggerType The analog trigger output that will trigger the counter. */ void xCounter::SetUpSource(AnalogTrigger *analogTrigger, AnalogTriggerOutput::Type triggerType) { if (StatusIsFatal()) return; SetUpSource(analogTrigger->CreateOutput(triggerType)); m_allocatedUpSource = true; }
/** * Set the upsource for the counter as a digital input channel. * The slot will be the default digital module slot. */ void xCounter::SetUpSource(UINT32 channel) { if (StatusIsFatal()) return; SetUpSource(GetDefaultDigitalModule(), channel); m_allocatedUpSource = true; }
/** * Set the up source for the counter as digital input channel and slot. * * @param moduleNumber The digital module (1 or 2). * @param channel The digital channel (1..14). */ void xCounter::SetUpSource(UINT8 moduleNumber, UINT32 channel) { if (StatusIsFatal()) return; SetUpSource(new DigitalInput(moduleNumber, channel)); m_allocatedUpSource = true; }
/** * Set the up counting source to be an analog trigger. * @param analogTrigger The analog trigger object that is used for the Up Source * @param triggerType The analog trigger output that will trigger the counter. */ void Counter::SetUpSource(AnalogTrigger &analogTrigger, AnalogTriggerOutput::Type triggerType) { SetUpSource(analogTrigger.CreateOutput(triggerType)); m_allocatedUpSource = true; }
/** * Create an instance of a Counter object. * Create an instance of an up-Counter given a digital module and a channel. * @param slot The cRIO chassis slot for the digital module used * @param channel The channel in the digital module */ Counter::Counter(UINT32 slot, UINT32 channel) { InitCounter(); SetUpSource(slot, channel); ClearDownSource(); }
/** * Set the up source for the counter as digital input channel and slot. * * @param moduleNumber The digital module (1 or 2). * @param channel The digital channel (1..14). */ void Counter::SetUpSource(uint8_t moduleNumber, uint32_t channel) { if (StatusIsFatal()) return; SetUpSource(new DigitalInput(moduleNumber, channel)); m_allocatedUpSource = true; }
/** * Set the up source for the counter as digital input channel and slot. */ void Counter::SetUpSource(UINT32 slot, UINT32 channel) { SetUpSource(new DigitalInput(slot, channel)); m_allocatedUpSource = true; }