Esempio n. 1
0
        /// <summary>
        /// Sets the down source object for the counter.
        /// </summary>
        /// <param name="source">The DigitalSource to use for counting down.</param>
        public void SetDownSource(DigitalSource source)
        {
            if (m_downSource != null && m_allocatedDownSource)
            {
                m_downSource.Dispose();
                m_allocatedDownSource = false;
            }
            m_downSource = source;
            int status = 0;

            HAL_SetCounterDownSource(m_counter, source.PortHandleForRouting, (HALAnalogTriggerType)source.AnalogTriggerTypeForRouting, ref status);
            CheckStatus(status);
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public override void Dispose()
        {
            if (ASource != null && m_allocatedA)
            {
                ASource.Dispose();
                m_allocatedA = false;
            }
            if (BSource != null && m_allocatedB)
            {
                BSource.Dispose();
                m_allocatedB = false;
            }
            if (IndexSource != null && m_allocatedI)
            {
                IndexSource.Dispose();
                m_allocatedI = false;
            }

            ASource     = null;
            BSource     = null;
            IndexSource = null;
            int status = 0;

            HAL_FreeEncoder(m_encoder, ref status);
            CheckStatus(status);
        }