Fork of original FastPWM libary from Sissors.

Dependents:   PM2_Libary PM2_Libary

Files at this revision

API Documentation at this revision

Comitter:
pmic
Date:
Mon Mar 21 13:31:01 2022 +0000
Parent:
36:1cc92cba9e04
Child:
38:b83caa1bcbc7
Commit message:
Added write fcn for float inputs in FastPWM.

Changed in this revision

FastPWM.h Show annotated file Show diff for this revision Revisions of this file
FastPWM_common.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/FastPWM.h	Mon Jan 24 10:07:25 2022 +0000
+++ b/FastPWM.h	Mon Mar 21 13:31:01 2022 +0000
@@ -105,6 +105,7 @@
     * @param duty - A double value representing the output duty-cycle, specified as a percentage.  The value should lie between 0.0 (representing on 0%) and 1.0 (representing on 100%).
     */
     void write(double duty);
+    void write(float duty);
     
     /**
     * Return the ouput duty-cycle, specified as a percentage (double)
--- a/FastPWM_common.cpp	Mon Jan 24 10:07:25 2022 +0000
+++ b/FastPWM_common.cpp	Mon Mar 21 13:31:01 2022 +0000
@@ -70,6 +70,10 @@
     pulsewidth_ticks(duty*getPeriod());
 }
 
+void FastPWM::write(float duty) {
+    write(static_cast<double>(duty));
+}
+
 double FastPWM::read( void ) {
     return _duty;
     }