public DutyCycleEncoder(DutyCycle dutyCycle) { m_dutyCycle = dutyCycle; m_analogTrigger = new AnalogTrigger(m_dutyCycle); m_counter = new UpDownCounter(); m_simDevice = SimDevice.Create("DutyCycleEncoder", m_dutyCycle.FPGAIndex); if (m_simDevice) { } m_analogTrigger.SetLimitsDutyCycle(0.25, 0.75); m_counter.UpSource = m_analogTrigger.CreateOutput(AnalogTriggerType.kRisingPulse); m_counter.DownSource = m_analogTrigger.CreateOutput(AnalogTriggerType.kFallingPulse); SendableRegistry.Instance.AddLW(this, "DutyCycle Encoder", m_dutyCycle.SourceChannel); }
/// <summary> /// Sets the down source for the counter as a <see cref="AnalogTrigger"/>. /// </summary> /// <param name="analogTrigger">The AnalogTrigger object that is used for the down source.</param> /// <param name="triggerType">The anlog trigger output that will trigger the counter.</param> public void SetDownSource(AnalogTrigger analogTrigger, AnalogTriggerType triggerType) { if (analogTrigger == null) { throw new ArgumentNullException(nameof(analogTrigger), "Analog Trigger given was null"); } SetDownSource(analogTrigger.CreateOutput(triggerType)); m_allocatedDownSource = true; }
/// <summary> /// Create an instance of a Counter object, using an AnalogTrigger. /// </summary> /// <remarks> /// Uses the trigger state output from the analog trigger. /// <para>The counter will start counting immediately.</para> /// </remarks> /// <param name="trigger">The <see cref="AnalogTrigger"/> to count.</param> public Counter(AnalogTrigger trigger) { if (trigger == null) { throw new ArgumentNullException(nameof(trigger), "The Analog Trigger given was null"); } InitCounter(Mode.TwoPulse); SetUpSource(trigger.CreateOutput(AnalogTriggerType.State)); }
public Counter(AnalogTrigger trigger) { if (trigger == null) { throw new ArgumentNullException(nameof(trigger), "The Analog Trigger given was null"); } InitCounter(Mode.TwoPulse); SetUpSource(trigger.CreateOutput(AnalogTriggerType.State)); }
public void SetDownSource(AnalogTrigger analogTrigger, AnalogTriggerType triggerType) { if (analogTrigger == null) throw new NullReferenceException("Analog Trigger given was null"); SetDownSource(analogTrigger.CreateOutput(triggerType)); m_allocatedDownSource = true; }
/// <summary> /// Sets the down source for the counter as a <see cref="AnalogTrigger"/>. /// </summary> /// <param name="analogTrigger">The AnalogTrigger object that is used for the down source.</param> /// <param name="triggerType">The anlog trigger output that will trigger the counter.</param> public void SetDownSource(AnalogTrigger analogTrigger, AnalogTriggerType triggerType) { if (analogTrigger == null) throw new ArgumentNullException(nameof(analogTrigger), "Analog Trigger given was null"); SetDownSource(analogTrigger.CreateOutput(triggerType)); m_allocatedDownSource = true; }