chiark / gitweb /
Updating softPwm to fix some typos.
[wiringPi.git] / wiringPi / softPwm.c
index 56bf4d88ffa661b498ff755fbca4340466e0e7a5..b568dfb45ca509131f1c013403b35fb79d38a1fc 100644 (file)
@@ -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 ;
 }