Servo library based on Timer instead of PWM. Fork of original https://os.mbed.com/users/jdenkers/code/Servo/ and modified for compatibility with MbedOS6+
Diff: Servo.cpp
- Revision:
- 2:2f6d7872d6f3
- Parent:
- 0:30b972d2dcec
diff -r 352133517ccc -r 2f6d7872d6f3 Servo.cpp --- a/Servo.cpp Sun Oct 17 13:34:19 2010 +0000 +++ b/Servo.cpp Fri Jun 10 04:22:15 2022 +0000 @@ -9,7 +9,7 @@ void Servo::StartPulse() { ServoPin = 1; - PulseStop.attach_us(this, &Servo::EndPulse, Position); + PulseStop.attach(callback(this, &Servo::EndPulse), std::chrono::microseconds(Position)); } void Servo::EndPulse() { @@ -18,7 +18,7 @@ void Servo::Enable(int StartPos, int Period) { Position = StartPos; - Pulse.attach_us(this, &Servo::StartPulse, Period); + Pulse.attach(callback(this, &Servo::StartPulse), std::chrono::microseconds(Period)); } void Servo::Disable() {