micropython/micropython — pull request #158 by dhylands (2014-01-12 19:14:22+00:00)
Title: Added servo support for Teensy

This particular implementation brings up bunch of issues that are worth discussing.

The stm servo class only allows being a limited number of pins.
The teensy servo class is modelled mostly from the Arduino one.
The teensy servo supports upto 12 servos on arbitrary pins, using a single timer and doesn't rely on hardware PWM (this limitation comes from wanting to keep a reasonable refresh rate.)
The teensy servo also supports tunable min and max values.
The teensy servo class currently maps 0 to the min and 180 to the max (as the Arduino one does).
The teensy servo implementation allows min > max (this effectively reverses the servo direction).

The getter/setter functions are modelled after the gpio one.

servo.angle() returns the current angle
servo.angle(90.0) sets the angle.

Is this "normal" (I've only just started using python in the last year, and I don't know whats considered normal in python circles).

If the stm servo class and the teensy servo provide the same functionality but different APIs. Perhaps I should call the teensy one TimerServo or something?