A class to control Servos attached to the Serial Wombat chip.
The SerialWombatServo class is used to control hobby servos attached to the Serial Wombat chip.
Any output-capable pin may be attached to an instance of the SerialWombatServo class. A separate instance should be declared for each Servo.
On the Serial Wombat 4A and Serial Wombat 4B chips servo output pulses are timed to 1uS precision using a timer interrupt.
On the Serial Wombat 18AB chip all Enhanced Digital Capability output pins (0-4,7,9-19) can be timed to sub-microsecond precision by sharing hardware timing resources (assuming resources are avaialble and have not be permanently claimed by PWM pin modes or other pin modes that claim and hold timing resources).
For SW18AB pins that are not enhanced, or if timing resources are not available the pin mode will degrade to using DMA based output with 17uS resolution. This equates to slightly better than 7 bit resolution for a 500-2500uS pulse range servo.
The SW4B_Ard_Servo example included with the Arduino library shows how to use this class.
This class uses "attach" rather than "begin" to initialize servos to be consistent with the Arduino Servo native API.
This function must be called after the SerialWombatChip instance specified in the constructor has been initialized with a begin call.
This function initializes a servo with a minimum pulse of 544 uS and a maximum pulse of 2400uS to be consistent with the native Arduino API attach function.
Parameters
pin
The Serial Wombat pin to set. Valid values for SW4A: 0-3 SW4B: 1-3
reverse
If true, the pulse widths will be reversed, with the longest pulse width corresponding to 0 position.
This funciton allows setting the "angle" of a servo, although actual travel may vary. Consider using the SerialWombatServo function write16bit() for higher resolution