ServoEasing
ServoEasing.h File Reference
#include <Servo.h>
#include <stdarg.h>
Include dependency graph for ServoEasing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ServoEasing
 

Macros

#define VERSION_SERVO_EASING   "3.6.0"
 
#define VERSION_SERVO_EASING_MAJOR   3
 
#define VERSION_SERVO_EASING_MINOR   6
 
#define VERSION_SERVO_EASING_PATCH   0
 
#define VERSION_HEX_VALUE(major, minor, patch)   ((major << 16) | (minor << 8) | (patch))
 
#define VERSION_SERVO_EASING_HEX   VERSION_HEX_VALUE(VERSION_SERVO_EASING_MAJOR, VERSION_SERVO_EASING_MINOR, VERSION_SERVO_EASING_PATCH)
 
#define MILLIS_IN_ONE_SECOND   1000L
 
#define START_EASE_TO_SPEED   5
 
#define MAX_EASING_SERVOS   12
 
#define DEFAULT_PULSE_WIDTH   1500
 
#define SERVO_REFRESH_INTERVAL_MICROS   20000
 
#define INVALID_SERVO   255
 
#define SERVO_REFRESH_INTERVAL_MILLIS   (SERVO_REFRESH_INTERVAL_MICROS/1000)
 
#define SERVO_REFRESH_FREQUENCY   (MILLIS_IN_ONE_SECOND/SERVO_REFRESH_INTERVAL_MILLIS)
 
#define THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS   360
 
#define MINIMUM_PULSE_WIDTH   400
 
#define MAXIMUM_PULSE_WIDTH   3500
 
#define DEFAULT_MICROSECONDS_FOR_0_DEGREE   544
 
#define DEFAULT_MICROSECONDS_FOR_45_DEGREE   (544 + ((2400 - 544) / 4))
 
#define DEFAULT_MICROSECONDS_FOR_90_DEGREE   (544 + ((2400 - 544) / 2))
 
#define DEFAULT_MICROSECONDS_FOR_135_DEGREE   (2400 - ((2400 - 544) / 4))
 
#define DEFAULT_MICROSECONDS_FOR_180_DEGREE   2400
 
#define DEFAULT_PCA9685_UNITS_FOR_0_DEGREE   111
 
#define DEFAULT_PCA9685_UNITS_FOR_45_DEGREE   (111 + ((491 - 111) / 4))
 
#define DEFAULT_PCA9685_UNITS_FOR_90_DEGREE   (111 + ((491 - 111) / 2))
 
#define DEFAULT_PCA9685_UNITS_FOR_135_DEGREE   (491 - ((491 - 111) / 4))
 
#define DEFAULT_PCA9685_UNITS_FOR_180_DEGREE   491
 
#define MICROSECONDS_FOR_ROTATING_SERVO_STOP   1500
 
#define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_MAX   (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 200)
 
#define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_HALF   (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 100)
 
#define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_QUARTER   (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 50)
 
#define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_MAX   (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 200)
 
#define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_HALF   (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 100)
 
#define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_QUARTER   (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 50)
 
#define ENABLE_EASE_QUADRATIC
 
#define ENABLE_EASE_CUBIC
 
#define ENABLE_EASE_QUARTIC
 
#define ENABLE_EASE_USER
 
#define ENABLE_EASE_SINE
 
#define ENABLE_EASE_CIRCULAR
 
#define ENABLE_EASE_BACK
 
#define ENABLE_EASE_ELASTIC
 
#define ENABLE_EASE_BOUNCE
 
#define ENABLE_EASE_PRECISION
 
#define EASE_FUNCTION_DEGREE_INDICATOR_OFFSET   200
 
#define EASE_FUNCTION_DEGREE_THRESHOLD   (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET - 180)
 
#define EASE_FUNCTION_MICROSECONDS_INDICATOR_OFFSET   (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET + 200)
 
#define CALL_STYLE_DIRECT   0x00
 
#define CALL_STYLE_IN   0x00
 
#define CALL_STYLE_OUT   0x40
 
#define CALL_STYLE_IN_OUT   0x80
 
#define CALL_STYLE_BOUNCING_OUT_IN   0xC0
 
#define CALL_STYLE_MASK   0xC0
 
#define EASE_TYPE_MASK   0x0F
 
#define EASE_LINEAR   0x00
 
#define EASE_QUADRATIC_IN   0x01
 
#define EASE_QUADRATIC_OUT   0x41
 
#define EASE_QUADRATIC_IN_OUT   0x81
 
#define EASE_QUADRATIC_BOUNCING   0xC1
 
#define EASE_CUBIC_IN   0x02
 
#define EASE_CUBIC_OUT   0x42
 
#define EASE_CUBIC_IN_OUT   0x82
 
#define EASE_CUBIC_BOUNCING   0xC2
 
#define EASE_QUARTIC_IN   0x03
 
#define EASE_QUARTIC_OUT   0x43
 
#define EASE_QUARTIC_IN_OUT   0x83
 
#define EASE_QUARTIC_BOUNCING   0xC3
 
#define EASE_USER_DIRECT   0x06
 
#define EASE_USER_IN   0x06
 
#define EASE_USER_OUT   0x46
 
#define EASE_USER_IN_OUT   0x86
 
#define EASE_USER_BOUNCING   0xC6
 
#define EASE_DUMMY_MOVE   0x07
 
#define EASE_SINE_IN   0x08
 
#define EASE_SINE_OUT   0x48
 
#define EASE_SINE_IN_OUT   0x88
 
#define EASE_SINE_BOUNCING   0xC8
 
#define EASE_CIRCULAR_IN   0x09
 
#define EASE_CIRCULAR_OUT   0x49
 
#define EASE_CIRCULAR_IN_OUT   0x89
 
#define EASE_CIRCULAR_BOUNCING   0xC9
 
#define EASE_BACK_IN   0x0A
 
#define EASE_BACK_OUT   0x4A
 
#define EASE_BACK_IN_OUT   0x8A
 
#define EASE_BACK_BOUNCING   0xCA
 
#define EASE_ELASTIC_IN   0x0B
 
#define EASE_ELASTIC_OUT   0x4B
 
#define EASE_ELASTIC_IN_OUT   0x8B
 
#define EASE_ELASTIC_BOUNCING   0xCB
 
#define EASE_BOUNCE_IN   0x4C
 
#define EASE_BOUNCE_OUT   0x0C
 
#define EASE_PRECISION_IN   0x0D
 
#define EASE_PRECISION_OUT   0x4D
 
#define PCA9685_GENERAL_CALL_ADDRESS   0x00
 
#define PCA9685_SOFTWARE_RESET   6
 
#define PCA9685_DEFAULT_ADDRESS   0x40
 
#define PCA9685_MAX_CHANNELS   16
 
#define PCA9685_MODE1_REGISTER   0x0
 
#define PCA9685_MODE_1_RESTART   7
 
#define PCA9685_MODE_1_AUTOINCREMENT   5
 
#define PCA9685_MODE_1_SLEEP   4
 
#define PCA9685_MODE1_EXTCLK   6
 
#define PCA9685_FIRST_PWM_REGISTER   0x06
 
#define PCA9685_PRESCALE_REGISTER   0xFE
 
#define PCA9685_ACTUAL_CLOCK_FREQUENCY   25000000L
 
#define PCA9685_PRESCALER_FOR_20_MS   ((PCA9685_ACTUAL_CLOCK_FREQUENCY /(4096L * 50)) - 1)
 
#define START_UPDATE_BY_INTERRUPT   true
 
#define DO_NOT_START_UPDATE_BY_INTERRUPT   false
 
#define mCurrentMicrosecondsOrUnits   mLastTargetMicrosecondsOrUnits
 
#define areInterruptsActive()   ServoEasing::areInterruptsActive()
 
#define sServoArray   ServoEasing::ServoEasingArray
 
#define sServoNextPositionArray   ServoEasing::ServoEasingNextPositionArray
 
#define STR_HELPER(x)   #x
 
#define STR(x)   STR_HELPER(x)
 

Functions

void writeAllServos (int aTargetDegreeOrMicrosecond)
 
void setSpeedForAllServos (uint_fast16_t aDegreesPerSecond)
 
bool setEaseToForAllServos ()
 Sets target position using content of ServoEasingNextPositionArray. More...
 
bool setEaseToForAllServos (uint_fast16_t aDegreesPerSecond)
 Sets target position using content of ServoEasingNextPositionArray and use aDegreesPerSecond instead of the one stored in mSpeed. More...
 
bool setEaseToDForAllServos (uint_fast16_t aMillisForMove)
 Sets target position using content of ServoEasingNextPositionArray and use aMillisForMove instead of the speed stored in mSpeed. More...
 
void setEaseToForAllServosSynchronizeAndStartInterrupt ()
 
void setEaseToForAllServosSynchronizeAndStartInterrupt (uint_fast16_t aDegreesPerSecond)
 
void synchronizeAllServosAndStartInterrupt (bool aStartUpdateByInterrupt=START_UPDATE_BY_INTERRUPT, bool aSynchronizeToMinimumDuration=false)
 Take the longest duration in order to move all servos synchronously. More...
 
void setEasingTypeForAllServos (uint_fast8_t aEasingType)
 60 us for single servo + 160 us per servo if using I2C e.g.for PCA9685 expander at 400 kHz or + 100 at 800 kHz 20 us for last interrupt The first servo pulse starts just after this interrupt routine has finished More...
 
void setEasingTypeForMultipleServos (uint_fast8_t aNumberOfServos, uint_fast8_t aEasingType)
 Sets easing type aEasingType for the first aNumberOfServos in ServoEasingArray[]. More...
 
void updateAndWaitForAllServosToStop ()
 Blocking wait until all servos are stopped. More...
 
bool delayAndUpdateAndWaitForAllServosToStop (unsigned long aMillisDelay, bool aTerminateDelayIfAllServosStopped=false)
 
void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop ()
 Synchronize and blocking wait until all servos are stopped Take the longer duration in order to move all servos synchronously. More...
 
void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop (uint_fast16_t aDegreesPerSecond)
 
void synchronizeAndEaseToArrayPositions () __attribute__((deprecated("Please use setEaseToForAllServosSynchronizeAndWait().")))
 
void synchronizeAndEaseToArrayPositions (uint_fast16_t aDegreesPerSecond) __attribute__((deprecated("Please use setEaseToForAllServosSynchronizeAndWait().")))
 
void synchronizeAllServosStartAndWaitForAllServosToStop ()
 Synchronize and blocking wait until all servos are stopped. More...
 
void printArrayPositions (Print *aSerial)
 Prints content of ServoNextPositionArray for debugging purposes. More...
 
bool isOneServoMoving ()
 
void stopAllServos ()
 
void resumeWithInterruptsAllServos ()
 
void resumeWithoutInterruptsAllServos ()
 
bool updateAllServos ()
 
void enableServoEasingInterrupt ()
 Timer1 is used for the Arduino Servo library. More...
 
void disableServoEasingInterrupt ()
 
int clipDegreeSpecial (uint_fast8_t aDegreeToClip)
 Clips the unsigned degree value and handles unsigned underflow. More...
 
bool checkI2CConnection (uint8_t aI2CAddress, Stream *aSerial)
 

Variables

const char easeTypeLinear[] PROGMEM
 

Macro Definition Documentation

◆ areInterruptsActive

#define areInterruptsActive ( )    ServoEasing::areInterruptsActive()

Definition at line 727 of file ServoEasing.h.

◆ CALL_STYLE_BOUNCING_OUT_IN

#define CALL_STYLE_BOUNCING_OUT_IN   0xC0

Definition at line 330 of file ServoEasing.h.

◆ CALL_STYLE_DIRECT

#define CALL_STYLE_DIRECT   0x00

Definition at line 326 of file ServoEasing.h.

◆ CALL_STYLE_IN

#define CALL_STYLE_IN   0x00

Definition at line 327 of file ServoEasing.h.

◆ CALL_STYLE_IN_OUT

#define CALL_STYLE_IN_OUT   0x80

Definition at line 329 of file ServoEasing.h.

◆ CALL_STYLE_MASK

#define CALL_STYLE_MASK   0xC0

Definition at line 332 of file ServoEasing.h.

◆ CALL_STYLE_OUT

#define CALL_STYLE_OUT   0x40

Definition at line 328 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_0_DEGREE

#define DEFAULT_MICROSECONDS_FOR_0_DEGREE   544

Definition at line 247 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_135_DEGREE

#define DEFAULT_MICROSECONDS_FOR_135_DEGREE   (2400 - ((2400 - 544) / 4))

Definition at line 250 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_180_DEGREE

#define DEFAULT_MICROSECONDS_FOR_180_DEGREE   2400

Definition at line 251 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_45_DEGREE

#define DEFAULT_MICROSECONDS_FOR_45_DEGREE   (544 + ((2400 - 544) / 4))

Definition at line 248 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_90_DEGREE

#define DEFAULT_MICROSECONDS_FOR_90_DEGREE   (544 + ((2400 - 544) / 2))

Definition at line 249 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_0_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_0_DEGREE   111

Definition at line 254 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_135_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_135_DEGREE   (491 - ((491 - 111) / 4))

Definition at line 257 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_180_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_180_DEGREE   491

Definition at line 258 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_45_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_45_DEGREE   (111 + ((491 - 111) / 4))

Definition at line 255 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_90_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_90_DEGREE   (111 + ((491 - 111) / 2))

Definition at line 256 of file ServoEasing.h.

◆ DEFAULT_PULSE_WIDTH

#define DEFAULT_PULSE_WIDTH   1500

Definition at line 183 of file ServoEasing.h.

◆ DO_NOT_START_UPDATE_BY_INTERRUPT

#define DO_NOT_START_UPDATE_BY_INTERRUPT   false

Definition at line 449 of file ServoEasing.h.

◆ EASE_BACK_BOUNCING

#define EASE_BACK_BOUNCING   0xCA

Definition at line 386 of file ServoEasing.h.

◆ EASE_BACK_IN

#define EASE_BACK_IN   0x0A

Definition at line 383 of file ServoEasing.h.

◆ EASE_BACK_IN_OUT

#define EASE_BACK_IN_OUT   0x8A

Definition at line 385 of file ServoEasing.h.

◆ EASE_BACK_OUT

#define EASE_BACK_OUT   0x4A

Definition at line 384 of file ServoEasing.h.

◆ EASE_BOUNCE_IN

#define EASE_BOUNCE_IN   0x4C

Definition at line 398 of file ServoEasing.h.

◆ EASE_BOUNCE_OUT

#define EASE_BOUNCE_OUT   0x0C

Definition at line 399 of file ServoEasing.h.

◆ EASE_CIRCULAR_BOUNCING

#define EASE_CIRCULAR_BOUNCING   0xC9

Definition at line 379 of file ServoEasing.h.

◆ EASE_CIRCULAR_IN

#define EASE_CIRCULAR_IN   0x09

Definition at line 376 of file ServoEasing.h.

◆ EASE_CIRCULAR_IN_OUT

#define EASE_CIRCULAR_IN_OUT   0x89

Definition at line 378 of file ServoEasing.h.

◆ EASE_CIRCULAR_OUT

#define EASE_CIRCULAR_OUT   0x49

Definition at line 377 of file ServoEasing.h.

◆ EASE_CUBIC_BOUNCING

#define EASE_CUBIC_BOUNCING   0xC2

Definition at line 348 of file ServoEasing.h.

◆ EASE_CUBIC_IN

#define EASE_CUBIC_IN   0x02

Definition at line 345 of file ServoEasing.h.

◆ EASE_CUBIC_IN_OUT

#define EASE_CUBIC_IN_OUT   0x82

Definition at line 347 of file ServoEasing.h.

◆ EASE_CUBIC_OUT

#define EASE_CUBIC_OUT   0x42

Definition at line 346 of file ServoEasing.h.

◆ EASE_DUMMY_MOVE

#define EASE_DUMMY_MOVE   0x07

Definition at line 366 of file ServoEasing.h.

◆ EASE_ELASTIC_BOUNCING

#define EASE_ELASTIC_BOUNCING   0xCB

Definition at line 393 of file ServoEasing.h.

◆ EASE_ELASTIC_IN

#define EASE_ELASTIC_IN   0x0B

Definition at line 390 of file ServoEasing.h.

◆ EASE_ELASTIC_IN_OUT

#define EASE_ELASTIC_IN_OUT   0x8B

Definition at line 392 of file ServoEasing.h.

◆ EASE_ELASTIC_OUT

#define EASE_ELASTIC_OUT   0x4B

Definition at line 391 of file ServoEasing.h.

◆ EASE_FUNCTION_DEGREE_INDICATOR_OFFSET

#define EASE_FUNCTION_DEGREE_INDICATOR_OFFSET   200

Definition at line 318 of file ServoEasing.h.

◆ EASE_FUNCTION_DEGREE_THRESHOLD

#define EASE_FUNCTION_DEGREE_THRESHOLD   (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET - 180)

Definition at line 319 of file ServoEasing.h.

◆ EASE_FUNCTION_MICROSECONDS_INDICATOR_OFFSET

#define EASE_FUNCTION_MICROSECONDS_INDICATOR_OFFSET   (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET + 200)

Definition at line 320 of file ServoEasing.h.

◆ EASE_LINEAR

#define EASE_LINEAR   0x00

Definition at line 335 of file ServoEasing.h.

◆ EASE_PRECISION_IN

#define EASE_PRECISION_IN   0x0D

Definition at line 403 of file ServoEasing.h.

◆ EASE_PRECISION_OUT

#define EASE_PRECISION_OUT   0x4D

Definition at line 404 of file ServoEasing.h.

◆ EASE_QUADRATIC_BOUNCING

#define EASE_QUADRATIC_BOUNCING   0xC1

Definition at line 341 of file ServoEasing.h.

◆ EASE_QUADRATIC_IN

#define EASE_QUADRATIC_IN   0x01

Definition at line 338 of file ServoEasing.h.

◆ EASE_QUADRATIC_IN_OUT

#define EASE_QUADRATIC_IN_OUT   0x81

Definition at line 340 of file ServoEasing.h.

◆ EASE_QUADRATIC_OUT

#define EASE_QUADRATIC_OUT   0x41

Definition at line 339 of file ServoEasing.h.

◆ EASE_QUARTIC_BOUNCING

#define EASE_QUARTIC_BOUNCING   0xC3

Definition at line 355 of file ServoEasing.h.

◆ EASE_QUARTIC_IN

#define EASE_QUARTIC_IN   0x03

Definition at line 352 of file ServoEasing.h.

◆ EASE_QUARTIC_IN_OUT

#define EASE_QUARTIC_IN_OUT   0x83

Definition at line 354 of file ServoEasing.h.

◆ EASE_QUARTIC_OUT

#define EASE_QUARTIC_OUT   0x43

Definition at line 353 of file ServoEasing.h.

◆ EASE_SINE_BOUNCING

#define EASE_SINE_BOUNCING   0xC8

Definition at line 372 of file ServoEasing.h.

◆ EASE_SINE_IN

#define EASE_SINE_IN   0x08

Definition at line 369 of file ServoEasing.h.

◆ EASE_SINE_IN_OUT

#define EASE_SINE_IN_OUT   0x88

Definition at line 371 of file ServoEasing.h.

◆ EASE_SINE_OUT

#define EASE_SINE_OUT   0x48

Definition at line 370 of file ServoEasing.h.

◆ EASE_TYPE_MASK

#define EASE_TYPE_MASK   0x0F

Definition at line 333 of file ServoEasing.h.

◆ EASE_USER_BOUNCING

#define EASE_USER_BOUNCING   0xC6

Definition at line 363 of file ServoEasing.h.

◆ EASE_USER_DIRECT

#define EASE_USER_DIRECT   0x06

Definition at line 359 of file ServoEasing.h.

◆ EASE_USER_IN

#define EASE_USER_IN   0x06

Definition at line 360 of file ServoEasing.h.

◆ EASE_USER_IN_OUT

#define EASE_USER_IN_OUT   0x86

Definition at line 362 of file ServoEasing.h.

◆ EASE_USER_OUT

#define EASE_USER_OUT   0x46

Definition at line 361 of file ServoEasing.h.

◆ ENABLE_EASE_BACK

#define ENABLE_EASE_BACK

Definition at line 294 of file ServoEasing.h.

◆ ENABLE_EASE_BOUNCE

#define ENABLE_EASE_BOUNCE

Definition at line 296 of file ServoEasing.h.

◆ ENABLE_EASE_CIRCULAR

#define ENABLE_EASE_CIRCULAR

Definition at line 293 of file ServoEasing.h.

◆ ENABLE_EASE_CUBIC

#define ENABLE_EASE_CUBIC

Definition at line 288 of file ServoEasing.h.

◆ ENABLE_EASE_ELASTIC

#define ENABLE_EASE_ELASTIC

Definition at line 295 of file ServoEasing.h.

◆ ENABLE_EASE_PRECISION

#define ENABLE_EASE_PRECISION

Definition at line 297 of file ServoEasing.h.

◆ ENABLE_EASE_QUADRATIC

#define ENABLE_EASE_QUADRATIC

Definition at line 287 of file ServoEasing.h.

◆ ENABLE_EASE_QUARTIC

#define ENABLE_EASE_QUARTIC

Definition at line 289 of file ServoEasing.h.

◆ ENABLE_EASE_SINE

#define ENABLE_EASE_SINE

Definition at line 292 of file ServoEasing.h.

◆ ENABLE_EASE_USER

#define ENABLE_EASE_USER

Definition at line 290 of file ServoEasing.h.

◆ INVALID_SERVO

#define INVALID_SERVO   255

Definition at line 195 of file ServoEasing.h.

◆ MAX_EASING_SERVOS

#define MAX_EASING_SERVOS   12

Definition at line 178 of file ServoEasing.h.

◆ MAXIMUM_PULSE_WIDTH

#define MAXIMUM_PULSE_WIDTH   3500

Definition at line 243 of file ServoEasing.h.

◆ mCurrentMicrosecondsOrUnits

#define mCurrentMicrosecondsOrUnits   mLastTargetMicrosecondsOrUnits

Definition at line 451 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_HALF

#define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_HALF   (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 100)

Definition at line 276 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_MAX

#define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_MAX   (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 200)

Definition at line 275 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_QUARTER

#define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_QUARTER   (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 50)

Definition at line 277 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_HALF

#define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_HALF   (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 100)

Definition at line 279 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_MAX

#define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_MAX   (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 200)

Definition at line 278 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_QUARTER

#define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_QUARTER   (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 50)

Definition at line 280 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_STOP

#define MICROSECONDS_FOR_ROTATING_SERVO_STOP   1500

Definition at line 270 of file ServoEasing.h.

◆ MILLIS_IN_ONE_SECOND

#define MILLIS_IN_ONE_SECOND   1000L

Definition at line 45 of file ServoEasing.h.

◆ MINIMUM_PULSE_WIDTH

#define MINIMUM_PULSE_WIDTH   400

Definition at line 240 of file ServoEasing.h.

◆ PCA9685_ACTUAL_CLOCK_FREQUENCY

#define PCA9685_ACTUAL_CLOCK_FREQUENCY   25000000L

Definition at line 442 of file ServoEasing.h.

◆ PCA9685_DEFAULT_ADDRESS

#define PCA9685_DEFAULT_ADDRESS   0x40

Definition at line 431 of file ServoEasing.h.

◆ PCA9685_FIRST_PWM_REGISTER

#define PCA9685_FIRST_PWM_REGISTER   0x06

Definition at line 438 of file ServoEasing.h.

◆ PCA9685_GENERAL_CALL_ADDRESS

#define PCA9685_GENERAL_CALL_ADDRESS   0x00

Definition at line 429 of file ServoEasing.h.

◆ PCA9685_MAX_CHANNELS

#define PCA9685_MAX_CHANNELS   16

Definition at line 432 of file ServoEasing.h.

◆ PCA9685_MODE1_EXTCLK

#define PCA9685_MODE1_EXTCLK   6

Definition at line 437 of file ServoEasing.h.

◆ PCA9685_MODE1_REGISTER

#define PCA9685_MODE1_REGISTER   0x0

Definition at line 433 of file ServoEasing.h.

◆ PCA9685_MODE_1_AUTOINCREMENT

#define PCA9685_MODE_1_AUTOINCREMENT   5

Definition at line 435 of file ServoEasing.h.

◆ PCA9685_MODE_1_RESTART

#define PCA9685_MODE_1_RESTART   7

Definition at line 434 of file ServoEasing.h.

◆ PCA9685_MODE_1_SLEEP

#define PCA9685_MODE_1_SLEEP   4

Definition at line 436 of file ServoEasing.h.

◆ PCA9685_PRESCALE_REGISTER

#define PCA9685_PRESCALE_REGISTER   0xFE

Definition at line 439 of file ServoEasing.h.

◆ PCA9685_PRESCALER_FOR_20_MS

#define PCA9685_PRESCALER_FOR_20_MS   ((PCA9685_ACTUAL_CLOCK_FREQUENCY /(4096L * 50)) - 1)

Definition at line 445 of file ServoEasing.h.

◆ PCA9685_SOFTWARE_RESET

#define PCA9685_SOFTWARE_RESET   6

Definition at line 430 of file ServoEasing.h.

◆ SERVO_REFRESH_FREQUENCY

#define SERVO_REFRESH_FREQUENCY   (MILLIS_IN_ONE_SECOND/SERVO_REFRESH_INTERVAL_MILLIS)

Definition at line 198 of file ServoEasing.h.

◆ SERVO_REFRESH_INTERVAL_MICROS

#define SERVO_REFRESH_INTERVAL_MICROS   20000

Definition at line 192 of file ServoEasing.h.

◆ SERVO_REFRESH_INTERVAL_MILLIS

#define SERVO_REFRESH_INTERVAL_MILLIS   (SERVO_REFRESH_INTERVAL_MICROS/1000)

Definition at line 197 of file ServoEasing.h.

◆ sServoArray

#define sServoArray   ServoEasing::ServoEasingArray

Definition at line 728 of file ServoEasing.h.

◆ sServoNextPositionArray

#define sServoNextPositionArray   ServoEasing::ServoEasingNextPositionArray

Definition at line 729 of file ServoEasing.h.

◆ START_EASE_TO_SPEED

#define START_EASE_TO_SPEED   5

Definition at line 51 of file ServoEasing.h.

◆ START_UPDATE_BY_INTERRUPT

#define START_UPDATE_BY_INTERRUPT   true

Definition at line 448 of file ServoEasing.h.

◆ STR

#define STR (   x)    STR_HELPER(x)

Definition at line 797 of file ServoEasing.h.

◆ STR_HELPER

#define STR_HELPER (   x)    #x

Definition at line 796 of file ServoEasing.h.

◆ THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS

#define THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS   360

Definition at line 224 of file ServoEasing.h.

◆ VERSION_HEX_VALUE

#define VERSION_HEX_VALUE (   major,
  minor,
  patch 
)    ((major << 16) | (minor << 8) | (patch))

Definition at line 41 of file ServoEasing.h.

◆ VERSION_SERVO_EASING

#define VERSION_SERVO_EASING   "3.6.0"

Definition at line 27 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_HEX

Definition at line 42 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_MAJOR

#define VERSION_SERVO_EASING_MAJOR   3

Definition at line 28 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_MINOR

#define VERSION_SERVO_EASING_MINOR   6

Definition at line 29 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_PATCH

#define VERSION_SERVO_EASING_PATCH   0

Definition at line 30 of file ServoEasing.h.

Function Documentation

◆ checkI2CConnection()

bool checkI2CConnection ( uint8_t  aI2CAddress,
Stream *  aSerial 
)

◆ clipDegreeSpecial()

int clipDegreeSpecial ( uint_fast8_t  aDegreeToClip)

Clips the unsigned degree value and handles unsigned underflow.

Returns
0 if aDegreeToClip >= 218 and 180 if 180 <= aDegreeToClip < 218

Definition at line 1991 of file ServoEasing.hpp.

◆ delayAndUpdateAndWaitForAllServosToStop()

bool delayAndUpdateAndWaitForAllServosToStop ( unsigned long  aMillisDelay,
bool  aTerminateDelayIfAllServosStopped 
)
Parameters
aMillisDelaythe milliseconds for blocking wait and update
aTerminateDelayIfAllServosStoppedif true, function returns before aMillisDelay if all servos are stopped
Returns
true if all Servos reached endAngle / stopped

Definition at line 2662 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ disableServoEasingInterrupt()

void disableServoEasingInterrupt ( )

Definition at line 2257 of file ServoEasing.hpp.

Here is the caller graph for this function:

◆ enableServoEasingInterrupt()

void enableServoEasingInterrupt ( )

Timer1 is used for the Arduino Servo library.

To have non blocking easing functions its unused channel B is used to generate an interrupt 100 us before the end of the 20 ms Arduino Servo refresh period. This interrupt then updates all servo values for the next refresh period. First interrupt is triggered not directly, but after 20 ms, since we are often called here at the time of the last interrupt of the preceding servo move.

Definition at line 2048 of file ServoEasing.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isOneServoMoving()

bool isOneServoMoving ( )

Definition at line 2579 of file ServoEasing.hpp.

Here is the caller graph for this function:

◆ printArrayPositions()

void printArrayPositions ( Print *  aSerial)

Prints content of ServoNextPositionArray for debugging purposes.

Parameters
aSerialThe Print object on which to write, for Arduino you can use &Serial.

Definition at line 2440 of file ServoEasing.hpp.

◆ resumeWithInterruptsAllServos()

void resumeWithInterruptsAllServos ( )

Definition at line 2611 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ resumeWithoutInterruptsAllServos()

void resumeWithoutInterruptsAllServos ( )

Definition at line 2619 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEaseToDForAllServos()

bool setEaseToDForAllServos ( uint_fast16_t  aMillisForMove)

Sets target position using content of ServoEasingNextPositionArray and use aMillisForMove instead of the speed stored in mSpeed.

Does not start interrupt/movement!

Returns
false if one servo was still moving

Definition at line 2568 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEaseToForAllServos() [1/2]

bool setEaseToForAllServos ( )

Sets target position using content of ServoEasingNextPositionArray.

Does not start interrupt/movement!

Returns
false if one servo was still moving

Definition at line 2535 of file ServoEasing.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEaseToForAllServos() [2/2]

bool setEaseToForAllServos ( uint_fast16_t  aDegreesPerSecond)

Sets target position using content of ServoEasingNextPositionArray and use aDegreesPerSecond instead of the one stored in mSpeed.

Does not start interrupt/movement!

Returns
false if one servo was still moving

Definition at line 2552 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEaseToForAllServosSynchronizeAndStartInterrupt() [1/2]

void setEaseToForAllServosSynchronizeAndStartInterrupt ( )

Definition at line 2402 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEaseToForAllServosSynchronizeAndStartInterrupt() [2/2]

void setEaseToForAllServosSynchronizeAndStartInterrupt ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2407 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEaseToForAllServosSynchronizeAndWaitForAllServosToStop() [1/2]

void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop ( )

Synchronize and blocking wait until all servos are stopped Take the longer duration in order to move all servos synchronously.

Definition at line 2416 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEaseToForAllServosSynchronizeAndWaitForAllServosToStop() [2/2]

void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2421 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEasingTypeForAllServos()

void setEasingTypeForAllServos ( uint_fast8_t  aEasingType)

60 us for single servo + 160 us per servo if using I2C e.g.for PCA9685 expander at 400 kHz or + 100 at 800 kHz 20 us for last interrupt The first servo pulse starts just after this interrupt routine has finished

Definition at line 2386 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ setEasingTypeForMultipleServos()

void setEasingTypeForMultipleServos ( uint_fast8_t  aNumberOfServos,
uint_fast8_t  aEasingType 
)

Sets easing type aEasingType for the first aNumberOfServos in ServoEasingArray[].

Definition at line 2393 of file ServoEasing.hpp.

Here is the caller graph for this function:

◆ setSpeedForAllServos()

void setSpeedForAllServos ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2475 of file ServoEasing.hpp.

◆ stopAllServos()

void stopAllServos ( )

Definition at line 2588 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ synchronizeAllServosAndStartInterrupt()

void synchronizeAllServosAndStartInterrupt ( bool  aStartUpdateByInterrupt,
bool  aSynchronizeToMinimumDuration 
)

Take the longest duration in order to move all servos synchronously.

Parameters
aSynchronizeToMinimumDuration- Take the shortest duration for synchronizing

Definition at line 2691 of file ServoEasing.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ synchronizeAllServosStartAndWaitForAllServosToStop()

void synchronizeAllServosStartAndWaitForAllServosToStop ( )

Synchronize and blocking wait until all servos are stopped.

Definition at line 2682 of file ServoEasing.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ synchronizeAndEaseToArrayPositions() [1/2]

void synchronizeAndEaseToArrayPositions ( )

Definition at line 2426 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ synchronizeAndEaseToArrayPositions() [2/2]

void synchronizeAndEaseToArrayPositions ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2431 of file ServoEasing.hpp.

Here is the call graph for this function:

◆ updateAllServos()

bool updateAllServos ( )
Returns
true if all Servos reached endAngle / stopped

Definition at line 2630 of file ServoEasing.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAndWaitForAllServosToStop()

void updateAndWaitForAllServosToStop ( )

Blocking wait until all servos are stopped.

Definition at line 2650 of file ServoEasing.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeAllServos()

void writeAllServos ( int  aTargetDegreeOrMicrosecond)

Definition at line 2467 of file ServoEasing.hpp.

Here is the call graph for this function:

Variable Documentation

◆ PROGMEM

const char* const easeTypeStrings [] PROGMEM

Definition at line 410 of file ServoEasing.h.