Beispiel #1
0
        /// <summary>
        /// Sets the index source for the encoder. Resets based on the <see cref="IndexingType"/> passed.
        /// </summary>
        /// <param name="source">The <see cref="DigitalSource"/> to set as the encoder index.</param>
        /// <param name="type">The state that will cause the encoder to reset.</param>
        public void SetIndexSource(DigitalSource source, IndexingType type = IndexingType.ResetOnRisingEdge)
        {
            int status = 0;

            HAL_SetEncoderIndexSource(m_encoder, source.PortHandleForRouting,
                                      (HALAnalogTriggerType)source.AnalogTriggerTypeForRouting, (HALEncoderIndexingType)type, ref status);
            CheckStatus(status);
        }
Beispiel #2
0
        /// <summary>
        /// Sets the index source for the encoder. Resets based on the <see cref="IndexingType"/> passed.
        /// </summary>
        /// <param name="channel">The DIO channel to set as the encoder index.</param>
        /// <param name="type">The state that will cause the encoder to reset.</param>
        public void SetIndexSource(int channel, IndexingType type = IndexingType.ResetOnRisingEdge)
        {
            if (m_allocatedI)
            {
                throw new AllocationException("Digital Input for Indexing already allocated");
            }

            IndexSource  = new DigitalInput(channel);
            m_allocatedI = true;
            SetIndexSource(IndexSource, type);
        }
        public void SetIndexSource(DigitalSource source, IndexingType type)
        {
            int status = 0;

            bool activeHigh = (type == IndexingType.ResetWhileHigh) || (type == IndexingType.ResetOnRisingEdge);
            bool edgeSensitive = (type == IndexingType.ResetOnFallingEdge) || (type == IndexingType.ResetOnRisingEdge);

            SetEncoderIndexSource(m_encoder, (uint)source.ChannelForRouting,
                source.AnalogTriggerForRouting, activeHigh, edgeSensitive, ref status);
            CheckStatus(status);
        }
        public void SetIndexSource(int channel, IndexingType type)
        {
            int status = 0;

            bool activeHigh = (type == IndexingType.ResetWhileHigh) || (type == IndexingType.ResetOnRisingEdge);
            bool edgeSensitive = (type == IndexingType.ResetOnFallingEdge) || (type == IndexingType.ResetOnRisingEdge);

            SetEncoderIndexSource(m_encoder, (uint)channel, false, activeHigh, edgeSensitive, ref status);
            CheckStatus(status);
        }