コード例 #1
0
ファイル: Channels.cs プロジェクト: lukazikus/mmc
        /// <summary>
        /// Returns true if the specified channel is a limit or kill switch and
        /// it is currently active.  This information comes from the limitStatus
        /// register.
        /// </summary>
        public static bool switchActive(this SmcVariables vars, SmcChannel channel)
        {
            switch (channel)
            {
            case SmcChannel.Analog1: return((vars.limitStatus & SmcLimitStatus.Analog1) != 0);

            case SmcChannel.Analog2: return((vars.limitStatus & SmcLimitStatus.Analog2) != 0);

            case SmcChannel.Rc1: return((vars.limitStatus & SmcLimitStatus.Rc1) != 0);

            case SmcChannel.Rc2: return((vars.limitStatus & SmcLimitStatus.Rc2) != 0);

            default: throw new Exception("Unknown Channel: " + channel.ToString());
            }
        }
コード例 #2
0
ファイル: Channels.cs プロジェクト: lukazikus/mmc
        /// <summary>
        /// Gets the state of the specified channel.
        /// </summary>
        /// <param name="vars">The state of the device.</param>
        /// <param name="channel">Specifies what channel to fetch.</param>
        /// <returns>The state of the specified channel.</returns>
        public static SmcChannelVariables getChannel(this SmcVariables vars, SmcChannel channel)
        {
            switch (channel)
            {
            case SmcChannel.Analog1: return(vars.analog1);

            case SmcChannel.Analog2: return(vars.analog2);

            case SmcChannel.Rc1: return(vars.rc1);

            case SmcChannel.Rc2: return(vars.rc2);

            default: throw new Exception("Unknown Channel: " + channel.ToString());
            }
        }