Beispiel #1
0
 /// <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 object that represents one of the four outputs from an analog trigger.
        /// </summary>
        /// <remarks>Because this class derives from DigitalSource, it can be passed into
	    /// routing functions for Counter, Encoder, etc.</remarks>
        /// <param name="trigger">The trigger for which this is an output.</param>
        /// <param name="outputType">An enum that specifies the output on the trigger to represent.</param>
        public AnalogTriggerOutput(AnalogTrigger trigger, AnalogTriggerType outputType)
        {
            if (trigger == null)
                throw new ArgumentNullException(nameof(trigger), "Analog Trigger given was null");
            m_trigger = trigger;
            m_outputType = outputType;

            HAL.Base.HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte)trigger.Index, (byte)outputType);
        }
        /// <summary>
        /// Create an object that represents one of the four outputs from an analog trigger.
        /// </summary>
        /// <remarks>Because this class derives from DigitalSource, it can be passed into
	    /// routing functions for Counter, Encoder, etc.</remarks>
        /// <param name="trigger">The trigger for which this is an output.</param>
        /// <param name="outputType">An enum that specifies the output on the trigger to represent.</param>
        public AnalogTriggerOutput(AnalogTrigger trigger, AnalogTriggerType outputType)
        {
            if (trigger == null)
                throw new NullReferenceException("Analog Trigger give was null");
            m_trigger = trigger;
            m_outputType = outputType;
            
            HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte) trigger.Index, (byte) outputType);
        }
Beispiel #4
0
        /// <summary>
        /// Create an object that represents one of the four outputs from an analog trigger.
        /// </summary>
        /// <remarks>Because this class derives from DigitalSource, it can be passed into
        /// routing functions for Counter, Encoder, etc.</remarks>
        /// <param name="trigger">The trigger for which this is an output.</param>
        /// <param name="outputType">An enum that specifies the output on the trigger to represent.</param>
        public AnalogTriggerOutput(AnalogTrigger trigger, AnalogTriggerType outputType)
        {
            if (trigger == null)
            {
                throw new ArgumentNullException(nameof(trigger), "Analog Trigger given was null");
            }
            m_trigger    = trigger;
            m_outputType = outputType;

            HAL.Base.HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte)trigger.Index, (byte)outputType);
        }
        public void TestAnalogTriggerOutputRoutings(AnalogTriggerType type)
        {
            using (AnalogTrigger trigger = new AnalogTrigger(0))
            {
                using (AnalogTriggerOutput output = new AnalogTriggerOutput(trigger, type))
                {
                    Assert.That(output.AnalogTriggerForRouting, Is.True);
                    int routingChannel = (trigger.Index << 2) + (int)type;
                    byte routingModule = (byte)(trigger.Index >> 2);

                    Assert.That(output.ChannelForRouting, Is.EqualTo(routingChannel));
                    Assert.That(output.ModuleForRouting, Is.EqualTo(routingModule));
                }
            }
        }
Beispiel #6
0
 public static void SetExternalTrigger(int handle, int digitalSourceHandle, AnalogTriggerType analogTriggerType, int rising, int falling)
 {
     lowLevel.HAL_SetDMAExternalTrigger(handle, digitalSourceHandle, analogTriggerType, rising, falling);
 }
 public static bool GetOutput(int analogTriggerHandle, AnalogTriggerType type)
 {
     return(lowLevel.HAL_GetAnalogTriggerOutput(analogTriggerHandle, type) != 0);
 }
Beispiel #8
0
 public static bool getAnalogTriggerOutput(IntPtr analog_trigger_pointer, AnalogTriggerType type, ref int status)
 {
     if (type == AnalogTriggerType.InWindow)
         return Base.HALAnalog.GetAnalogTriggerInWindow(analog_trigger_pointer, ref status);
     if (type == AnalogTriggerType.State)
         return Base.HALAnalog.GetAnalogTriggerTriggerState(analog_trigger_pointer, ref status);
     else
     {
         status = HALErrorConstants.ANALOG_TRIGGER_PULSE_OUTPUT_ERROR;
         return false;
     }
 }
 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;
 }
Beispiel #10
0
 public static void SetDownSource(int counterHandle, int digitalSourceHandle, AnalogTriggerType analogTriggerType)
 {
     lowLevel.HAL_SetCounterDownSource(counterHandle, digitalSourceHandle, analogTriggerType);
 }
 /// <summary>
 /// Gets the trigger value.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="status">The status.</param>
 /// <returns></returns>
 public bool GetTriggerValue(AnalogTriggerType type, ref int status)
 {
     return SimulatorHAL.HALAnalog.getAnalogTriggerOutput((IntPtr) TriggerPointer, type, ref status);
 }
Beispiel #12
0
 public static int Initialize(int digitalSourceHandleA, AnalogTriggerType analogTriggerTypeA, int digitalSourceHandleB, AnalogTriggerType analogTriggerTypeB, int reverseDirection, EncoderEncodingType encodingType)
 {
     return(lowLevel.HAL_InitializeEncoder(digitalSourceHandleA, analogTriggerTypeA, digitalSourceHandleB, analogTriggerTypeB, reverseDirection, encodingType));
 }
Beispiel #13
0
 public static void SetIndexSource(int encoderHandle, int digitalSourceHandle, AnalogTriggerType analogTriggerType, EncoderIndexingType type)
 {
     lowLevel.HAL_SetEncoderIndexSource(encoderHandle, digitalSourceHandle, analogTriggerType, type);
 }
Beispiel #14
0
 /// <summary>
 /// Creates an <see cref="AnalogTriggerOutput">analog trigger output</see>.
 /// </summary>
 /// <param name="type">The type of object to create.</param>
 /// <returns>A pointer to a new <see cref="AnalogTriggerOutput"/></returns>
 public AnalogTriggerOutput CreateOutput(AnalogTriggerType type)
 {
     return(new AnalogTriggerOutput(this, type));
 }
Beispiel #15
0
 public static void StartAutoTrigger(SPIPort port, int digitalSourceHandle, AnalogTriggerType analogTriggerType, int triggerRising, int triggerFalling)
 {
     lowLevel.HAL_StartSPIAutoTrigger(port, digitalSourceHandle, analogTriggerType, triggerRising, triggerFalling);
 }
 /// <summary>
 /// Creates an <see cref="AnalogTriggerOutput">analog trigger output</see>. 
 /// </summary>
 /// <param name="type">The type of object to create.</param>
 /// <returns>A pointer to a new <see cref="AnalogTriggerOutput"/></returns>
 public AnalogTriggerOutput CreateOutput(AnalogTriggerType type)
 {
     return new AnalogTriggerOutput(this, type);
 }
Beispiel #17
0
 public static void Request(int interruptHandle, int digitalSourceHandle, AnalogTriggerType analogTriggerType)
 {
     lowLevel.HAL_RequestInterrupts(interruptHandle, digitalSourceHandle, analogTriggerType);
 }
Beispiel #18
0
 /// <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;
 }
Beispiel #19
0
 public static int Initialize(int digitalSourceHandle, AnalogTriggerType triggerType)
 {
     return(lowLevel.HAL_InitializeDutyCycle(digitalSourceHandle, triggerType));
 }
 public static extern bool getAnalogTriggerOutput(IntPtr analog_trigger_pointer, AnalogTriggerType type, ref int status);