QAQ ==!
Dependencies: mbed QEI-1 nRF24L01P xiugai
Diff: drivers/IO_pwm.cpp
- Revision:
- 12:741de117e1ee
- Parent:
- 9:d03b1af2b8d8
--- a/drivers/IO_pwm.cpp Thu Nov 14 03:16:22 2019 +0000 +++ b/drivers/IO_pwm.cpp Fri Nov 29 16:07:26 2019 +0000 @@ -12,8 +12,6 @@ } */ -#ifdef ENABLE_IO_PWM - #include "IO_pwm.h" #include "mbed.h" @@ -28,13 +26,13 @@ void IO_pwm::toggleOn(void) { DigitalOut mypwm(_n); mypwm = 1; - timer.attach_us(Callback<void()>(this,&IO_pwm::toggleOff), on_delay); //类里启动中断,函数名需要特殊处理,按照这个方式拷贝就可以了 + timer.attach_us(this, &IO_pwm::toggleOff, on_delay); //类里启动中断,函数名需要特殊处理,按照这个方式拷贝就可以了 } void IO_pwm::toggleOff(void) { DigitalOut mypwm(_n); mypwm = 0; - timer.attach_us(Callback<void()>(this,&IO_pwm::toggleOn), off_delay); + timer.attach_us(this, &IO_pwm::toggleOn, off_delay); } // 周期p_us = signal period in micro_seconds @@ -55,5 +53,4 @@ this->toggleOn(); } -#endif // ENABLE_IO_PWM