Beispiel #1
0
        /// <summary>
        /// Opens the PWM pin.
        /// </summary>
        /// <param name="chip">The PWM chip number.</param>
        /// <param name="pin">The PWM pin (channel) number to control.</param>
        public PwmPin(int chip, int pin)
        {
            var ret = NativePwm.Open(chip, pin, out _handle);

            if (ret != Internals.Errors.ErrorCode.None)
            {
                throw ExceptionFactory.CreateException(ret);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Disposes the PWM.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            NativePwm.Close(_handle);
            _disposed = true;
        }