コード例 #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;
 }
コード例 #2
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);
        }
コード例 #3
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 NullReferenceException("Analog Trigger give was null");
            m_trigger = trigger;
            m_outputType = outputType;
            
            HAL.Report(ResourceType.kResourceType_AnalogTriggerOutput, (byte) trigger.Index, (byte) outputType);
        }
コード例 #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);
        }
コード例 #5
0
        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));
                }
            }
        }
コード例 #6
0
 public static void SetExternalTrigger(int handle, int digitalSourceHandle, AnalogTriggerType analogTriggerType, int rising, int falling)
 {
     lowLevel.HAL_SetDMAExternalTrigger(handle, digitalSourceHandle, analogTriggerType, rising, falling);
 }
コード例 #7
0
 public static bool GetOutput(int analogTriggerHandle, AnalogTriggerType type)
 {
     return(lowLevel.HAL_GetAnalogTriggerOutput(analogTriggerHandle, type) != 0);
 }
コード例 #8
0
ファイル: HALAnalog.cs プロジェクト: chopshop-166/WPILib
 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;
     }
 }
コード例 #9
0
 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;
 }
コード例 #10
0
ファイル: CounterLowLevel.cs プロジェクト: robotdotnet/WPILib
 public static void SetDownSource(int counterHandle, int digitalSourceHandle, AnalogTriggerType analogTriggerType)
 {
     lowLevel.HAL_SetCounterDownSource(counterHandle, digitalSourceHandle, analogTriggerType);
 }
コード例 #11
0
 /// <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);
 }
コード例 #12
0
ファイル: EncoderLowLevel.cs プロジェクト: robotdotnet/WPILib
 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));
 }
コード例 #13
0
ファイル: EncoderLowLevel.cs プロジェクト: robotdotnet/WPILib
 public static void SetIndexSource(int encoderHandle, int digitalSourceHandle, AnalogTriggerType analogTriggerType, EncoderIndexingType type)
 {
     lowLevel.HAL_SetEncoderIndexSource(encoderHandle, digitalSourceHandle, analogTriggerType, type);
 }
コード例 #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));
 }
コード例 #15
0
 public static void StartAutoTrigger(SPIPort port, int digitalSourceHandle, AnalogTriggerType analogTriggerType, int triggerRising, int triggerFalling)
 {
     lowLevel.HAL_StartSPIAutoTrigger(port, digitalSourceHandle, analogTriggerType, triggerRising, triggerFalling);
 }
コード例 #16
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);
 }
コード例 #17
0
 public static void Request(int interruptHandle, int digitalSourceHandle, AnalogTriggerType analogTriggerType)
 {
     lowLevel.HAL_RequestInterrupts(interruptHandle, digitalSourceHandle, analogTriggerType);
 }
コード例 #18
0
ファイル: Counter.cs プロジェクト: chopshop-166/WPILib
 /// <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;
 }
コード例 #19
0
 public static int Initialize(int digitalSourceHandle, AnalogTriggerType triggerType)
 {
     return(lowLevel.HAL_InitializeDutyCycle(digitalSourceHandle, triggerType));
 }
コード例 #20
0
 public static extern bool getAnalogTriggerOutput(IntPtr analog_trigger_pointer, AnalogTriggerType type, ref int status);