softPWM
Diff: SoftPWM.cpp
- Revision:
- 2:594922580cdc
- Parent:
- 0:9a7ca977803b
--- a/SoftPWM.cpp Wed Jan 29 09:20:03 2020 +0000 +++ b/SoftPWM.cpp Thu Mar 04 11:58:09 2021 +0000 @@ -30,7 +30,8 @@ void SoftPWM::start() { - _ticker.attach(this,&SoftPWM::TickerInterrapt,interval); +// _ticker.attach(this,&SoftPWM::TickerInterrapt,interval); + _ticker.attach(Callback<void(void)>(this, &SoftPWM::TickerInterrapt), interval); } void SoftPWM::stop() @@ -40,7 +41,7 @@ pulse = 0; else pulse = 1; - wait(width); + thread_sleep_for(width*1000); } void SoftPWM::period(float _period) @@ -80,7 +81,8 @@ void SoftPWM::TickerInterrapt() { if ( width <= 0 ) return; - _timeout.attach(this,&SoftPWM::end,width); +// _timeout.attach(this, &SoftPWM::end, width); + _timeout.attach(callback(this, &SoftPWM::end), width); if ( positive ) pulse = 1; else