Editing Stop Function

Dependents:   SensorMatic_Project

Fork of SoftPWM by syouichi imamori

Files at this revision

API Documentation at this revision

Comitter:
ll13jdb
Date:
Thu May 05 14:53:39 2016 +0000
Parent:
0:7918ce37626c
Commit message:
edited stop function;

Changed in this revision

SoftPWM.cpp Show annotated file Show diff for this revision Revisions of this file
SoftPWM.h Show annotated file Show diff for this revision Revisions of this file
diff -r 7918ce37626c -r ba793e34f506 SoftPWM.cpp
--- a/SoftPWM.cpp	Wed Oct 23 19:31:14 2013 +0000
+++ b/SoftPWM.cpp	Thu May 05 14:53:39 2016 +0000
@@ -16,16 +16,16 @@
 
 float SoftPWM::read()
 {
-    if ( width <= 0.0 ) return 0.0;
-    if ( width > 1.0 )  return 1.0;
+    if ( width <= 0.0f ) return 0.0;
+    if ( width > 1.0f )  return 1.0;
     return width / interval;    
 }
 
 void SoftPWM::write(float duty)
 {
     width = interval * duty;
-    if ( duty <= 0.0 ) width =  0.0;
-    if ( duty > 1.0 )  width =  interval;
+    if ( duty <= 0.0f ) width =  0.0;
+    if ( duty > 1.0f )  width =  interval;
 }
 
 void SoftPWM::start()
diff -r 7918ce37626c -r ba793e34f506 SoftPWM.h
--- a/SoftPWM.h	Wed Oct 23 19:31:14 2013 +0000
+++ b/SoftPWM.h	Thu May 05 14:53:39 2016 +0000
@@ -30,14 +30,14 @@
     void period_us(int);
     void stop();
     operator float()  { 
-        if ( width <= 0.0 ) return 0.0;
-        if ( width > 1.0 )  return 1.0;
+        if ( width <= 0.0f ) return 0.0;
+        if ( width > 1.0f )  return 1.0;
         return width / interval;
     }
     SoftPWM& operator=(float duty)  {
         width = interval * duty;
-        if ( duty <= 0.0 ) width =  0.0;
-        if ( duty > 1.0 )  width =  interval;
+        if ( duty <= 0.0f ) width =  0.0;
+        if ( duty > 1.0f )  width =  interval;
         return *this;
     }