namespace Unosquare.WiringPi.Native { using System.Runtime.InteropServices; public partial class WiringPi { #region WiringPi - Soft PWM (https://github.com/WiringPi/WiringPi/blob/master/wiringPi/softPwm.h) /// /// This creates a software controlled PWM pin. You can use any GPIO pin and the pin numbering will be that of the wiringPiSetup() /// function you used. Use 100 for the pwmRange, then the value can be anything from 0 (off) to 100 (fully on) for the given pin. /// The return value is 0 for success. Anything else and you should check the global errno variable to see what went wrong. /// /// The pin. /// The initial value. /// The PWM range. /// The result. [DllImport(WiringPiLibrary, EntryPoint = "softPwmCreate", SetLastError = true)] public static extern int SoftPwmCreate(int pin, int initialValue, int pwmRange); /// /// This updates the PWM value on the given pin. The value is checked to be in-range and pins that haven’t previously /// been initialized via softPwmCreate will be silently ignored. /// /// The pin. /// The value. [DllImport(WiringPiLibrary, EntryPoint = "softPwmWrite", SetLastError = true)] public static extern void SoftPwmWrite(int pin, int value); /// /// This function is undocumented. /// /// The pin. [DllImport(WiringPiLibrary, EntryPoint = "softPwmStop", SetLastError = true)] public static extern void SoftPwmStop(int pin); /// /// This creates a software controlled tone pin. You can use any GPIO pin and the pin numbering will be that of the wiringPiSetup() function you used. /// The return value is 0 for success. Anything else and you should check the global errno variable to see what went wrong. /// /// The pin. /// The result. [DllImport(WiringPiLibrary, EntryPoint = "softToneCreate", SetLastError = true)] public static extern int SoftToneCreate(int pin); /// /// This function is undocumented. /// /// The pin. [DllImport(WiringPiLibrary, EntryPoint = "softToneStop", SetLastError = true)] public static extern void SoftToneStop(int pin); /// /// This updates the tone frequency value on the given pin. The tone will be played until you set the frequency to 0. /// /// The pin. /// The freq. [DllImport(WiringPiLibrary, EntryPoint = "softToneWrite", SetLastError = true)] public static extern void SoftToneWrite(int pin, int freq); #endregion } }