Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PwmIn.cpp
00001 #include "PwmIn.h" 00002 00003 PwmIn::PwmIn(PinName p) : _p(p) { 00004 _p.rise(this, &PwmIn::rise); 00005 _p.fall(this, &PwmIn::fall); 00006 _period = 0.0; 00007 _pulsewidth = 0.0; 00008 _t.start(); 00009 } 00010 00011 float PwmIn::period() { 00012 return _period; 00013 } 00014 00015 float PwmIn::pulsewidth() { 00016 return _pulsewidth; 00017 } 00018 00019 float PwmIn::dutycycle() { 00020 return _pulsewidth / _period; 00021 } 00022 00023 void PwmIn::rise() { 00024 _period = _t.read(); 00025 _t.reset(); 00026 } 00027 00028 void PwmIn::fall() { 00029 _pulsewidth = _t.read(); 00030 }
Generated on Wed Jul 20 2022 07:28:50 by
