diff --git a/wiringPi/softPwm.c b/wiringPi/softPwm.c index 56bf4d8..b568dfb 100644 --- a/wiringPi/softPwm.c +++ b/wiringPi/softPwm.c @@ -84,8 +84,22 @@ static PI_THREAD (softPwmThread) return NULL ; } + +/* + * softPwmWrite: + * Write a PWM value to the given pin + ********************************************************************************* + */ + void softPwmWrite (int pin, int value) { + pin &= 63 ; + + /**/ if (value < 0) + value = 0 ; + else if (value > range [pin]) + value = range [pin] ; + marks [pin] = value ; } diff --git a/wiringPi/softPwm.h b/wiringPi/softPwm.h index a6d8cd4..4a17cb0 100644 --- a/wiringPi/softPwm.h +++ b/wiringPi/softPwm.h @@ -22,6 +22,5 @@ *********************************************************************** */ -extern int setupSoftPwm (int pin) ; -extern int softPwmCreate (int pin, int value, int range) ; -extern void softPwmWrite (int pin, int value) ; +extern int softPwmCreate (int pin, int value, int range) ; +extern void softPwmWrite (int pin, int value) ;