Serial Wombat Arduino Library
Public Member Functions | List of all members
SerialWombatServo_18AB Class Reference

A derived class that adds additional Servo Functionality for the Serial Wombat 18AB Chip. More...

#include <SerialWombatServo.h>

Inheritance diagram for SerialWombatServo_18AB:
SerialWombatServo SerialWombatAbstractScaledOutput SerialWombatPin SerialWombatHighFrequencyServo

Public Member Functions

 SerialWombatServo_18AB (SerialWombatChip &serialWombat)
 
uint8_t pin ()
 
uint8_t swPinModeNumber ()
 
- Public Member Functions inherited from SerialWombatServo
 SerialWombatServo (SerialWombatChip &sw)
 Constructor for the SerialWombatServo Class. More...
 
 ~SerialWombatServo ()
 
void attach (uint8_t pin, bool reverse)
 Initialize a servo on the specified pin. More...
 
void attach (uint8_t pin, uint16_t min=544, uint16_t max=2400, bool reverse=false)
 Initialize a servo on the specified pin. More...
 
void write (uint8_t angle)
 Writes a value to the servo. More...
 
void write16bit (uint16_t position)
 Writes a 16 bit value to the servo. More...
 
uint8_t read (void)
 returns the last position of the servo scaled to a number from 0 to 180. More...
 
- Public Member Functions inherited from SerialWombatPin
 SerialWombatPin (SerialWombatChip &serialWombatChip)
 Instantiates a Serial Wombat Pin. More...
 
 SerialWombatPin (SerialWombatChip &serialWombatChip, uint8_t pin)
 Instantiates a Serial Wombat Pin. More...
 
uint16_t readPublicData ()
 Read the 16 Bit public data associated with this pin. More...
 
void pinMode (uint8_t mode)
 Set pin to INPUT or OUTPUT. More...
 
void pinMode (uint8_t mode, bool pullDown, bool openDrain)
 Set pin to INPUT or OUTPUT, with options for pull Ups and open Drain settings. More...
 
void digitalWrite (uint8_t val)
 Set output pin High or Low. More...
 
int digitalRead ()
 Reads the state of the Pin. More...
 
uint16_t writePublicData (uint16_t value)
 Write a 16 bit value to this pin. More...
 
uint8_t pin ()
 Returns the current SW pin number. Used primarily for virtual calls by derived classes. More...
 
uint8_t swPinModeNumber ()
 Returns the Mode number. Used primarily by derived classes to populate packet data. More...
 
- Public Member Functions inherited from SerialWombatAbstractScaledOutput
 SerialWombatAbstractScaledOutput (SerialWombatChip &sw)
 Constructor for the SerialWombatAbstractScaledOutput Class. More...
 
int16_t writeTimeout (uint16_t timeout_mS, uint16_t timeoutOutputValue)
 
int16_t writeScalingEnabled (bool enabled, uint8_t sourcePin)
 
int16_t writeInputScaling (uint16_t inputMin, uint16_t inputMax)
 
int16_t writeOutputScaling (uint16_t outputMin, uint16_t outputMax)
 
int16_t writeScalingInvertedInput (bool inverted)
 
int16_t writeScalingTargetValue (uint16_t target)
 
int16_t configureRateControl (uint8_t sampleRate, uint16_t filterConstant)
 
int16_t configure1stOrderFiltering (uint8_t sampleRate, uint16_t filterConstant)
 
int16_t configureHysteresis (uint16_t lowLimit, uint16_t lowOutputValue, uint16_t highLimit, uint16_t highOutputValue, uint16_t initialOutputValue)
 
int16_t configurePID (uint16_t kp, uint16_t ki, uint16_t kd, uint16_t target, uint8_t sampleRate)
 

Additional Inherited Members

- Protected Member Functions inherited from SerialWombatServo
void initializeServo ()
 
- Protected Attributes inherited from SerialWombatServo
uint16_t _position = 0
 
uint16_t _min = 544
 
uint16_t _max = 2400
 
bool _reverse = false
 
- Protected Attributes inherited from SerialWombatPin
uint8_t _pin = 255
 
SerialWombatChip_sw
 
uint8_t _pinMode = 0
 

Detailed Description

A derived class that adds additional Servo Functionality for the Serial Wombat 18AB Chip.

The SerialWombatServo_18AB class is used to control hobby servos attached to the Serial Wombat chip.

This class extends SerialWombatServo by adding support for SerialWombatAbstractScaledOutput interfaces

Any output-capable pin may be attached to an instance of the SerialWombatServo_18AB class. A separate instance should be declared for each Servo.

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.

This class uses "attach" rather than "begin" to initialize servos to be consistent with the Arduino Servo native API.

Constructor & Destructor Documentation

◆ SerialWombatServo_18AB()

SerialWombatServo_18AB::SerialWombatServo_18AB ( SerialWombatChip serialWombat)

Member Function Documentation

◆ pin()

uint8_t SerialWombatServo_18AB::pin ( )
virtual

◆ swPinModeNumber()

uint8_t SerialWombatServo_18AB::swPinModeNumber ( )
virtual