コード例 #1
0
        public void Stop(int channelIndex)
        {
            // This assumes that PwmController has ensured that the channel is already open
            Windows10PwmDriverChannel channel = _channelMap[channelIndex];

            channel.Stop();
        }
コード例 #2
0
        public void ChangeDutyCycle(int channelIndex, double dutyCyclePercentage)
        {
            // This assumes that PwmController has ensured that the channel is already open
            Windows10PwmDriverChannel channel = _channelMap[channelIndex];

            channel.ChangeDutyCycle(dutyCyclePercentage);
        }
コード例 #3
0
        public void Start(int channelIndex, double frequencyInHertz, double dutyCyclePercentage)
        {
            // This assumes that PwmController has ensured that the channel is already open
            Windows10PwmDriverChannel channel = _channelMap[channelIndex];

            _winController.SetDesiredFrequency(frequencyInHertz);
            channel.Start(dutyCyclePercentage);
        }
コード例 #4
0
 public void OpenChannel(int channelIndex)
 {
     if (!_channelMap.TryGetValue(channelIndex, out Windows10PwmDriverChannel channel))
     {
         channel = new Windows10PwmDriverChannel(_winController, channelIndex);
         _channelMap.Add(channelIndex, channel);
     }
 }
コード例 #5
0
 /// <summary>
 /// Opens a channel in order for it to be ready to use.
 /// </summary>
 /// <param name="pwmChannel">The PWM channel.</param>
 public void OpenChannel(int pwmChannel)
 {
     if (!_channelMap.TryGetValue(pwmChannel, out _))
     {
         Windows10PwmDriverChannel channel = new Windows10PwmDriverChannel(_winController, pwmChannel);
         _channelMap.Add(pwmChannel, channel);
     }
 }
コード例 #6
0
        /// <summary>
        /// Closes the channel.
        /// </summary>
        /// <param name="channelIndex">The PWM channel to close.</param>
        /// <returns><see langword="true" /> if the chip has no more open channels open upon exiting; <see langword="false" /> otherwise.</returns>
        public bool CloseChannel(int channelIndex)
        {
            // This assumes that PwmController has ensured that the channel is already open
            Windows10PwmDriverChannel channel = _channelMap[channelIndex];

            channel.Dispose();
            _channelMap.Remove(channelIndex);

            return(_channelMap.Count == 0);
        }