RSeries astromech firmware
ServoDispatchPCA9685< numServos, defaultOEValue > Class Template Reference

#include <ServoDispatchPCA9685.h>

Detailed Description

template<uint16_t numServos, byte defaultOEValue = HIGH>
class ServoDispatchPCA9685< numServos, defaultOEValue >

Implements ServoDispatch over i2c to PCA9685.

Implements ServoDispatch and spreads the PWM output to up to 62 PCA9685 modules (via i2c address 0x40-0x75). Theoretically allowing you to control up to 992 PWM outputs.

OE pin defaults to LOW.

+ Inheritance diagram for ServoDispatchPCA9685< numServos, defaultOEValue >:
+ Collaboration diagram for ServoDispatchPCA9685< numServos, defaultOEValue >:

Public Member Functions

 ServoDispatchPCA9685 (TwoWire *i2c, uint8_t startAddress=0x40)
 Constructor. More...
 
 ServoDispatchPCA9685 (TwoWire *i2c, const ServoSettings *settings, uint8_t startAddress=0x40)
 Constructor. More...
 
 ServoDispatchPCA9685 (const ServoSettings *settings, uint8_t startAddress=0x40)
 Constructor. More...
 
 ServoDispatchPCA9685 (uint8_t startAddress=0x40)
 Constructor. More...
 
byte numberOfPCA9685Chips ()
 
virtual uint16_t getNumServos () override
 
void ensureDisabled ()
 
void ensureEnabled ()
 
void setOutputEnablePin (const byte outputEnablePin, bool outputAutoOff=true)
 
void setClockCalibration (const uint32_t clock[(numServos/16)+1])
 
virtual uint8_t getPin (uint16_t num) override
 
virtual uint16_t getStart (uint16_t num) override
 
virtual uint16_t getEnd (uint16_t num) override
 
virtual uint16_t getMinimum (uint16_t num) override
 
virtual uint16_t getNeutral (uint16_t num) override
 
virtual uint16_t getMaximum (uint16_t num) override
 
virtual uint32_t getGroup (uint16_t num) override
 
virtual uint16_t currentPos (uint16_t num) override
 
virtual void setPin (uint16_t num, uint16_t pin) override
 
virtual void setNeutral (uint16_t num, uint16_t neutralPulse) override
 
virtual void setStart (uint16_t num, uint16_t startPulse) override
 
virtual void setEnd (uint16_t num, uint16_t endPulse) override
 
virtual void setServo (uint16_t num, uint8_t pin, uint16_t startPulse, uint16_t endPulse, uint16_t neutralPulse, uint32_t group) override
 
virtual void stop () override
 
virtual uint16_t scaleToPos (uint16_t num, float scale) override
 
virtual void setup () override
 Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More...
 
virtual bool isActive (uint16_t num) override
 
virtual void disable (uint16_t num) override
 
virtual void animate () override
 Subclasses must implement this function to run through a single frame of animation/activity. More...
 
void setOutput (uint16_t servoChannel, bool state)
 
void setPrescale (uint8_t prescale)
 
uint8_t getPrescale (uint8_t chipNumber)
 
void setEnvironmentTemperatureCelsius (int8_t degreesInCelsius)
 
void setChannelStaggering (bool value)
 
float getNominalUpdateFrequency (uint32_t clockFrequency, uint8_t prescale)
 
void setClockFrequency (const uint32_t clocks[(numServos/16)+1])
 
void setUpdateFrequency (const float targetUpdateFrequency[(numServos/16)+1])
 
uint8_t getCalculatedPrescale (uint32_t calculatedClockFrequency, float targetUpdateFrequency)
 
uint16_t getCalibratedSteps (uint8_t chip, uint16_t targetLength)
 
float getCalculatedResolution (uint8_t chip)
 
void setPWMFull (uint16_t servoChannel)
 
void setPWMOff (uint16_t servoChannel)
 
void setPWM (uint16_t servoChannel, uint16_t on, uint16_t off)
 
void setPWM (uint16_t servoChannel, uint16_t targetLength)
 
void setPWMAll (uint16_t targetLength)
 
void setOutputAll (bool state)
 
int mapPulselength (double microseconds)
 
- Public Member Functions inherited from ServoDispatch
virtual void setGroup (uint16_t num, uint32_t group)
 
void moveTo (uint16_t num, uint32_t startDelay, uint32_t moveTime, float pos)
 
void moveTo (uint16_t num, uint32_t moveTime, float pos)
 
void moveTo (uint16_t num, float pos)
 
void moveTo (uint16_t num, uint32_t startDelay, uint32_t moveTime, float startPos, float pos)
 
void moveServosTo (uint32_t servoGroupMask, float pos)
 
void moveServosTo (uint32_t servoGroupMask, uint32_t moveTime, float pos)
 
void moveServosTo (uint32_t servoGroupMask, uint32_t startDelay, uint32_t moveTime, float pos)
 
void moveServosTo (uint32_t servoGroupMask, uint32_t startDelay, uint32_t moveTimeMin, uint32_t moveTimeMax, float pos)
 
void moveServoSetTo (uint32_t servoGroupMask, uint32_t servoSetMask, float onPos, float offPos, float(*onEasingMethod)(float)=NULL, float(*offEasingMethod)(float)=NULL)
 
void moveServoSetTo (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t moveTime, float onPos, float offPos, float(*onEasingMethod)(float)=NULL, float(*offEasingMethod)(float)=NULL)
 
void moveServoSetTo (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t startDelay, uint32_t moveTime, float onPos, float offPos, float(*onEasingMethod)(float)=NULL, float(*offEasingMethod)(float)=NULL)
 
void moveServoSetTo (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t startDelay, uint32_t moveTimeMin, uint32_t moveTimeMax, float onPos, float offPos, float(*onEasingMethod)(float)=NULL, float(*offEasingMethod)(float)=NULL)
 
void moveToPulse (uint16_t num, uint32_t startDelay, uint32_t moveTime, uint16_t pos)
 
void moveToPulse (uint16_t num, uint32_t moveTime, uint16_t pos)
 
void moveToPulse (uint16_t num, uint16_t pos)
 
void moveToPulse (uint16_t num, uint32_t startDelay, uint32_t moveTime, uint16_t startPos, uint16_t pos)
 
void moveByPulse (uint16_t num, uint32_t moveTime, int16_t pos)
 
void moveByPulse (uint16_t num, int16_t pos)
 
void moveByPulse (uint16_t num, uint32_t startDelay, uint32_t moveTime, int16_t pos)
 
void moveServosToPulse (uint32_t servoGroupMask, uint16_t pos)
 
void moveServosToPulse (uint32_t servoGroupMask, uint32_t moveTime, uint16_t pos)
 
void moveServosToPulse (uint32_t servoGroupMask, uint32_t startDelay, uint32_t moveTime, uint16_t pos)
 
void moveServosToPulse (uint32_t servoGroupMask, uint32_t startDelay, uint32_t moveTimeMin, uint32_t moveTimeMax, int16_t pos)
 
void moveServosByPulse (uint32_t servoGroupMask, uint32_t moveTime, uint16_t pos)
 
void moveServosByPulse (uint32_t servoGroupMask, uint32_t startDelay, uint32_t moveTime, int16_t pos)
 
void moveServosByPulse (uint32_t servoGroupMask, uint32_t startDelay, uint32_t moveTimeMin, uint32_t moveTimeMax, int16_t pos)
 
void moveServoSetToPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint16_t onPos, uint16_t offPos)
 
void moveServoSetToPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t moveTime, uint16_t onPos, uint16_t offPos)
 
void moveServoSetToPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t startDelay, uint32_t moveTime, uint16_t onPos, uint16_t offPos)
 
void moveServoSetToPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t startDelay, uint32_t moveTimeMin, uint32_t moveTimeMax, int16_t onPos, int16_t offPos)
 
void moveServoSetByPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t moveTime, int16_t onPos, int16_t offPos)
 
void moveServoSetByPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t startDelay, uint32_t moveTime, int16_t onPos, int16_t offPos)
 
void moveServoSetByPulse (uint32_t servoGroupMask, uint32_t servoSetMask, uint32_t startDelay, uint32_t moveTimeMin, uint32_t moveTimeMax, int16_t onPos, int16_t offPos)
 
void setServoEasingMethod (uint16_t num, float(*easingMethod)(float completion))
 
void setServosEasingMethod (uint32_t servoGroupMask, float(*easingMethod)(float completion))
 
void setEasingMethod (float(*easingMethod)(float completion))
 

Additional Inherited Members

Constructor & Destructor Documentation

◆ ServoDispatchPCA9685() [1/4]

template<uint16_t numServos, byte defaultOEValue = HIGH>
ServoDispatchPCA9685< numServos, defaultOEValue >::ServoDispatchPCA9685 ( TwoWire *  i2c,
uint8_t  startAddress = 0x40 
)
inline

Constructor.

◆ ServoDispatchPCA9685() [2/4]

template<uint16_t numServos, byte defaultOEValue = HIGH>
ServoDispatchPCA9685< numServos, defaultOEValue >::ServoDispatchPCA9685 ( TwoWire *  i2c,
const ServoSettings settings,
uint8_t  startAddress = 0x40 
)
inline

Constructor.

◆ ServoDispatchPCA9685() [3/4]

template<uint16_t numServos, byte defaultOEValue = HIGH>
ServoDispatchPCA9685< numServos, defaultOEValue >::ServoDispatchPCA9685 ( const ServoSettings settings,
uint8_t  startAddress = 0x40 
)
inline

Constructor.

◆ ServoDispatchPCA9685() [4/4]

template<uint16_t numServos, byte defaultOEValue = HIGH>
ServoDispatchPCA9685< numServos, defaultOEValue >::ServoDispatchPCA9685 ( uint8_t  startAddress = 0x40)
inline

Constructor.

Member Function Documentation

◆ animate()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::animate ( )
inlineoverridevirtual

Subclasses must implement this function to run through a single frame of animation/activity.

Subclasses should not call delay() or otherwise block.

Implements AnimatedEvent.

◆ currentPos()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::currentPos ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ disable()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::disable ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ ensureDisabled()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::ensureDisabled ( )
inline

◆ ensureEnabled()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::ensureEnabled ( )
inline

◆ getCalculatedPrescale()

template<uint16_t numServos, byte defaultOEValue = HIGH>
uint8_t ServoDispatchPCA9685< numServos, defaultOEValue >::getCalculatedPrescale ( uint32_t  calculatedClockFrequency,
float  targetUpdateFrequency 
)
inline

◆ getCalculatedResolution()

template<uint16_t numServos, byte defaultOEValue = HIGH>
float ServoDispatchPCA9685< numServos, defaultOEValue >::getCalculatedResolution ( uint8_t  chip)
inline

◆ getCalibratedSteps()

template<uint16_t numServos, byte defaultOEValue = HIGH>
uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getCalibratedSteps ( uint8_t  chip,
uint16_t  targetLength 
)
inline

◆ getEnd()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getEnd ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ getGroup()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint32_t ServoDispatchPCA9685< numServos, defaultOEValue >::getGroup ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ getMaximum()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getMaximum ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ getMinimum()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getMinimum ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ getNeutral()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getNeutral ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ getNominalUpdateFrequency()

template<uint16_t numServos, byte defaultOEValue = HIGH>
float ServoDispatchPCA9685< numServos, defaultOEValue >::getNominalUpdateFrequency ( uint32_t  clockFrequency,
uint8_t  prescale 
)
inline

◆ getNumServos()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getNumServos ( )
inlineoverridevirtual

Implements ServoDispatch.

◆ getPin()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint8_t ServoDispatchPCA9685< numServos, defaultOEValue >::getPin ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ getPrescale()

template<uint16_t numServos, byte defaultOEValue = HIGH>
uint8_t ServoDispatchPCA9685< numServos, defaultOEValue >::getPrescale ( uint8_t  chipNumber)
inline

◆ getStart()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::getStart ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ isActive()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual bool ServoDispatchPCA9685< numServos, defaultOEValue >::isActive ( uint16_t  num)
inlineoverridevirtual

Implements ServoDispatch.

◆ mapPulselength()

template<uint16_t numServos, byte defaultOEValue = HIGH>
int ServoDispatchPCA9685< numServos, defaultOEValue >::mapPulselength ( double  microseconds)
inline

◆ numberOfPCA9685Chips()

template<uint16_t numServos, byte defaultOEValue = HIGH>
byte ServoDispatchPCA9685< numServos, defaultOEValue >::numberOfPCA9685Chips ( )
inline

◆ scaleToPos()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual uint16_t ServoDispatchPCA9685< numServos, defaultOEValue >::scaleToPos ( uint16_t  num,
float  scale 
)
inlineoverridevirtual

Implements ServoDispatch.

◆ setChannelStaggering()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setChannelStaggering ( bool  value)
inline

◆ setClockCalibration()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setClockCalibration ( const uint32_t  clock[(numServos/16)+1])
inline

◆ setClockFrequency()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setClockFrequency ( const uint32_t  clocks[(numServos/16)+1])
inline

◆ setEnd()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::setEnd ( uint16_t  num,
uint16_t  endPulse 
)
inlineoverridevirtual

Reimplemented from ServoDispatch.

◆ setEnvironmentTemperatureCelsius()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setEnvironmentTemperatureCelsius ( int8_t  degreesInCelsius)
inline

◆ setNeutral()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::setNeutral ( uint16_t  num,
uint16_t  neutralPulse 
)
inlineoverridevirtual

Reimplemented from ServoDispatch.

◆ setOutput()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setOutput ( uint16_t  servoChannel,
bool  state 
)
inline

◆ setOutputAll()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setOutputAll ( bool  state)
inline

◆ setOutputEnablePin()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setOutputEnablePin ( const byte  outputEnablePin,
bool  outputAutoOff = true 
)
inline

◆ setPin()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::setPin ( uint16_t  num,
uint16_t  pin 
)
inlineoverridevirtual

Reimplemented from ServoDispatch.

◆ setPrescale()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setPrescale ( uint8_t  prescale)
inline

◆ setPWM() [1/2]

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setPWM ( uint16_t  servoChannel,
uint16_t  on,
uint16_t  off 
)
inline

◆ setPWM() [2/2]

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setPWM ( uint16_t  servoChannel,
uint16_t  targetLength 
)
inlinevirtual

Implements ServoDispatch.

◆ setPWMAll()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setPWMAll ( uint16_t  targetLength)
inline

◆ setPWMFull()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setPWMFull ( uint16_t  servoChannel)
inline

◆ setPWMOff()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setPWMOff ( uint16_t  servoChannel)
inline

◆ setServo()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::setServo ( uint16_t  num,
uint8_t  pin,
uint16_t  startPulse,
uint16_t  endPulse,
uint16_t  neutralPulse,
uint32_t  group 
)
inlineoverridevirtual

Implements ServoDispatch.

◆ setStart()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::setStart ( uint16_t  num,
uint16_t  startPulse 
)
inlineoverridevirtual

Reimplemented from ServoDispatch.

◆ setup()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::setup ( )
inlineoverridevirtual

Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.

Implements SetupEvent.

◆ setUpdateFrequency()

template<uint16_t numServos, byte defaultOEValue = HIGH>
void ServoDispatchPCA9685< numServos, defaultOEValue >::setUpdateFrequency ( const float  targetUpdateFrequency[(numServos/16)+1])
inline

◆ stop()

template<uint16_t numServos, byte defaultOEValue = HIGH>
virtual void ServoDispatchPCA9685< numServos, defaultOEValue >::stop ( )
inlineoverridevirtual

Implements ServoDispatch.


The documentation for this class was generated from the following file: