예제 #1
0
        /// <summary>
        /// Gets the analog value of the specified <paramref name="ioLine"/>.
        /// </summary>
        /// <example>To verify if this sample contains an analog value for the specified
        /// <paramref name="ioLine"/>, use the method <see cref="HasAnalogValue(IOLine)"/>.
        /// <c>if (ioSample.HasAnalogValue(IOLine.DIO0_AD0)) {
        /// var value = ioSample.GetAnalogValue(IOLine.DIO0_AD0);
        /// ...
        /// } else {
        /// ...
        /// }
        /// }</c></example>
        /// <param name="ioLine">The IO line to get its analog value.</param>
        /// <returns>The analog value of the given IO line.</returns>
        /// <seealso cref="AnalogValues"/>
        /// <seealso cref="HasAnalogValue"/>
        /// <seealso cref="HasAnalogValues"/>
        /// <seealso cref="IOLine"/>
        public int GetAnalogValue(IOLine ioLine)
        {
            if (!AnalogValues.ContainsKey(ioLine))
            {
                return(int.MaxValue);
            }

            return(AnalogValues[ioLine]);
        }
예제 #2
0
 /// <summary>
 /// Indicates whether or not the specified <paramref name="ioLine"/> has an analog value.
 /// </summary>
 /// <param name="ioLine">The IO line to check if has an analog value.</param>
 /// <returns><c>true</c> if the specified <paramref name="ioLine"/> has an analog value,
 /// <c>false</c> otherwise.</returns>
 /// <seealso cref="GetAnalogValue"/>
 /// <seealso cref="AnalogValues"/>
 /// <seealso cref="HasAnalogValues"/>
 /// <seealso cref="IOLine"/>
 public bool HasAnalogValue(IOLine ioLine)
 {
     return(AnalogValues.ContainsKey(ioLine));
 }