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.2.0"
 
#define VERSION_SERVO_EASING_MAJOR   3
 
#define VERSION_SERVO_EASING_MINOR   2
 
#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 REFRESH_INTERVAL   20000
 
#define INVALID_SERVO   255
 
#define REFRESH_INTERVAL_MICROS   REFRESH_INTERVAL
 
#define REFRESH_INTERVAL_MILLIS   (REFRESH_INTERVAL/1000)
 
#define REFRESH_FREQUENCY   (MILLIS_IN_ONE_SECOND/REFRESH_INTERVAL_MILLIS)
 
#define THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS   360
 
#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_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 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)
 Take the longer 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. 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 669 of file ServoEasing.h.

◆ CALL_STYLE_BOUNCING_OUT_IN

#define CALL_STYLE_BOUNCING_OUT_IN   0xC0

Definition at line 292 of file ServoEasing.h.

◆ CALL_STYLE_DIRECT

#define CALL_STYLE_DIRECT   0x00

Definition at line 288 of file ServoEasing.h.

◆ CALL_STYLE_IN

#define CALL_STYLE_IN   0x00

Definition at line 289 of file ServoEasing.h.

◆ CALL_STYLE_IN_OUT

#define CALL_STYLE_IN_OUT   0x80

Definition at line 291 of file ServoEasing.h.

◆ CALL_STYLE_MASK

#define CALL_STYLE_MASK   0xC0

Definition at line 294 of file ServoEasing.h.

◆ CALL_STYLE_OUT

#define CALL_STYLE_OUT   0x40

Definition at line 290 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_0_DEGREE

#define DEFAULT_MICROSECONDS_FOR_0_DEGREE   544

Definition at line 209 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_135_DEGREE

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

Definition at line 212 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_180_DEGREE

#define DEFAULT_MICROSECONDS_FOR_180_DEGREE   2400

Definition at line 213 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_45_DEGREE

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

Definition at line 210 of file ServoEasing.h.

◆ DEFAULT_MICROSECONDS_FOR_90_DEGREE

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

Definition at line 211 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_0_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_0_DEGREE   111

Definition at line 216 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_135_DEGREE

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

Definition at line 219 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_180_DEGREE

#define DEFAULT_PCA9685_UNITS_FOR_180_DEGREE   491

Definition at line 220 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_45_DEGREE

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

Definition at line 217 of file ServoEasing.h.

◆ DEFAULT_PCA9685_UNITS_FOR_90_DEGREE

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

Definition at line 218 of file ServoEasing.h.

◆ DEFAULT_PULSE_WIDTH

#define DEFAULT_PULSE_WIDTH   1500

Definition at line 163 of file ServoEasing.h.

◆ DO_NOT_START_UPDATE_BY_INTERRUPT

#define DO_NOT_START_UPDATE_BY_INTERRUPT   false

Definition at line 410 of file ServoEasing.h.

◆ EASE_BACK_BOUNCING

#define EASE_BACK_BOUNCING   0xCA

Definition at line 348 of file ServoEasing.h.

◆ EASE_BACK_IN

#define EASE_BACK_IN   0x0A

Definition at line 345 of file ServoEasing.h.

◆ EASE_BACK_IN_OUT

#define EASE_BACK_IN_OUT   0x8A

Definition at line 347 of file ServoEasing.h.

◆ EASE_BACK_OUT

#define EASE_BACK_OUT   0x4A

Definition at line 346 of file ServoEasing.h.

◆ EASE_BOUNCE_IN

#define EASE_BOUNCE_IN   0x4C

Definition at line 360 of file ServoEasing.h.

◆ EASE_BOUNCE_OUT

#define EASE_BOUNCE_OUT   0x0C

Definition at line 361 of file ServoEasing.h.

◆ EASE_CIRCULAR_BOUNCING

#define EASE_CIRCULAR_BOUNCING   0xC9

Definition at line 341 of file ServoEasing.h.

◆ EASE_CIRCULAR_IN

#define EASE_CIRCULAR_IN   0x09

Definition at line 338 of file ServoEasing.h.

◆ EASE_CIRCULAR_IN_OUT

#define EASE_CIRCULAR_IN_OUT   0x89

Definition at line 340 of file ServoEasing.h.

◆ EASE_CIRCULAR_OUT

#define EASE_CIRCULAR_OUT   0x49

Definition at line 339 of file ServoEasing.h.

◆ EASE_CUBIC_BOUNCING

#define EASE_CUBIC_BOUNCING   0xC2

Definition at line 310 of file ServoEasing.h.

◆ EASE_CUBIC_IN

#define EASE_CUBIC_IN   0x02

Definition at line 307 of file ServoEasing.h.

◆ EASE_CUBIC_IN_OUT

#define EASE_CUBIC_IN_OUT   0x82

Definition at line 309 of file ServoEasing.h.

◆ EASE_CUBIC_OUT

#define EASE_CUBIC_OUT   0x42

Definition at line 308 of file ServoEasing.h.

◆ EASE_DUMMY_MOVE

#define EASE_DUMMY_MOVE   0x07

Definition at line 328 of file ServoEasing.h.

◆ EASE_ELASTIC_BOUNCING

#define EASE_ELASTIC_BOUNCING   0xCB

Definition at line 355 of file ServoEasing.h.

◆ EASE_ELASTIC_IN

#define EASE_ELASTIC_IN   0x0B

Definition at line 352 of file ServoEasing.h.

◆ EASE_ELASTIC_IN_OUT

#define EASE_ELASTIC_IN_OUT   0x8B

Definition at line 354 of file ServoEasing.h.

◆ EASE_ELASTIC_OUT

#define EASE_ELASTIC_OUT   0x4B

Definition at line 353 of file ServoEasing.h.

◆ EASE_FUNCTION_DEGREE_INDICATOR_OFFSET

#define EASE_FUNCTION_DEGREE_INDICATOR_OFFSET   200

Definition at line 280 of file ServoEasing.h.

◆ EASE_FUNCTION_DEGREE_THRESHOLD

#define EASE_FUNCTION_DEGREE_THRESHOLD   (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET - 180)

Definition at line 281 of file ServoEasing.h.

◆ EASE_FUNCTION_MICROSECONDS_INDICATOR_OFFSET

#define EASE_FUNCTION_MICROSECONDS_INDICATOR_OFFSET   (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET + 200)

Definition at line 282 of file ServoEasing.h.

◆ EASE_LINEAR

#define EASE_LINEAR   0x00

Definition at line 297 of file ServoEasing.h.

◆ EASE_PRECISION_IN

#define EASE_PRECISION_IN   0x0D

Definition at line 365 of file ServoEasing.h.

◆ EASE_PRECISION_OUT

#define EASE_PRECISION_OUT   0x4D

Definition at line 366 of file ServoEasing.h.

◆ EASE_QUADRATIC_BOUNCING

#define EASE_QUADRATIC_BOUNCING   0xC1

Definition at line 303 of file ServoEasing.h.

◆ EASE_QUADRATIC_IN

#define EASE_QUADRATIC_IN   0x01

Definition at line 300 of file ServoEasing.h.

◆ EASE_QUADRATIC_IN_OUT

#define EASE_QUADRATIC_IN_OUT   0x81

Definition at line 302 of file ServoEasing.h.

◆ EASE_QUADRATIC_OUT

#define EASE_QUADRATIC_OUT   0x41

Definition at line 301 of file ServoEasing.h.

◆ EASE_QUARTIC_BOUNCING

#define EASE_QUARTIC_BOUNCING   0xC3

Definition at line 317 of file ServoEasing.h.

◆ EASE_QUARTIC_IN

#define EASE_QUARTIC_IN   0x03

Definition at line 314 of file ServoEasing.h.

◆ EASE_QUARTIC_IN_OUT

#define EASE_QUARTIC_IN_OUT   0x83

Definition at line 316 of file ServoEasing.h.

◆ EASE_QUARTIC_OUT

#define EASE_QUARTIC_OUT   0x43

Definition at line 315 of file ServoEasing.h.

◆ EASE_SINE_BOUNCING

#define EASE_SINE_BOUNCING   0xC8

Definition at line 334 of file ServoEasing.h.

◆ EASE_SINE_IN

#define EASE_SINE_IN   0x08

Definition at line 331 of file ServoEasing.h.

◆ EASE_SINE_IN_OUT

#define EASE_SINE_IN_OUT   0x88

Definition at line 333 of file ServoEasing.h.

◆ EASE_SINE_OUT

#define EASE_SINE_OUT   0x48

Definition at line 332 of file ServoEasing.h.

◆ EASE_TYPE_MASK

#define EASE_TYPE_MASK   0x0F

Definition at line 295 of file ServoEasing.h.

◆ EASE_USER_BOUNCING

#define EASE_USER_BOUNCING   0xC6

Definition at line 325 of file ServoEasing.h.

◆ EASE_USER_DIRECT

#define EASE_USER_DIRECT   0x06

Definition at line 321 of file ServoEasing.h.

◆ EASE_USER_IN

#define EASE_USER_IN   0x06

Definition at line 322 of file ServoEasing.h.

◆ EASE_USER_IN_OUT

#define EASE_USER_IN_OUT   0x86

Definition at line 324 of file ServoEasing.h.

◆ EASE_USER_OUT

#define EASE_USER_OUT   0x46

Definition at line 323 of file ServoEasing.h.

◆ ENABLE_EASE_BACK

#define ENABLE_EASE_BACK

Definition at line 256 of file ServoEasing.h.

◆ ENABLE_EASE_BOUNCE

#define ENABLE_EASE_BOUNCE

Definition at line 258 of file ServoEasing.h.

◆ ENABLE_EASE_CIRCULAR

#define ENABLE_EASE_CIRCULAR

Definition at line 255 of file ServoEasing.h.

◆ ENABLE_EASE_CUBIC

#define ENABLE_EASE_CUBIC

Definition at line 250 of file ServoEasing.h.

◆ ENABLE_EASE_ELASTIC

#define ENABLE_EASE_ELASTIC

Definition at line 257 of file ServoEasing.h.

◆ ENABLE_EASE_PRECISION

#define ENABLE_EASE_PRECISION

Definition at line 259 of file ServoEasing.h.

◆ ENABLE_EASE_QUADRATIC

#define ENABLE_EASE_QUADRATIC

Definition at line 249 of file ServoEasing.h.

◆ ENABLE_EASE_QUARTIC

#define ENABLE_EASE_QUARTIC

Definition at line 251 of file ServoEasing.h.

◆ ENABLE_EASE_SINE

#define ENABLE_EASE_SINE

Definition at line 254 of file ServoEasing.h.

◆ ENABLE_EASE_USER

#define ENABLE_EASE_USER

Definition at line 252 of file ServoEasing.h.

◆ INVALID_SERVO

#define INVALID_SERVO   255

Definition at line 169 of file ServoEasing.h.

◆ MAX_EASING_SERVOS

#define MAX_EASING_SERVOS   12

Definition at line 158 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 238 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 237 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 239 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 241 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 240 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 242 of file ServoEasing.h.

◆ MICROSECONDS_FOR_ROTATING_SERVO_STOP

#define MICROSECONDS_FOR_ROTATING_SERVO_STOP   1500

Definition at line 232 of file ServoEasing.h.

◆ MILLIS_IN_ONE_SECOND

#define MILLIS_IN_ONE_SECOND   1000L

Definition at line 41 of file ServoEasing.h.

◆ PCA9685_ACTUAL_CLOCK_FREQUENCY

#define PCA9685_ACTUAL_CLOCK_FREQUENCY   25000000L

Definition at line 403 of file ServoEasing.h.

◆ PCA9685_DEFAULT_ADDRESS

#define PCA9685_DEFAULT_ADDRESS   0x40

Definition at line 393 of file ServoEasing.h.

◆ PCA9685_FIRST_PWM_REGISTER

#define PCA9685_FIRST_PWM_REGISTER   0x06

Definition at line 399 of file ServoEasing.h.

◆ PCA9685_GENERAL_CALL_ADDRESS

#define PCA9685_GENERAL_CALL_ADDRESS   0x00

Definition at line 391 of file ServoEasing.h.

◆ PCA9685_MAX_CHANNELS

#define PCA9685_MAX_CHANNELS   16

Definition at line 394 of file ServoEasing.h.

◆ PCA9685_MODE1_REGISTER

#define PCA9685_MODE1_REGISTER   0x0

Definition at line 395 of file ServoEasing.h.

◆ PCA9685_MODE_1_AUTOINCREMENT

#define PCA9685_MODE_1_AUTOINCREMENT   5

Definition at line 397 of file ServoEasing.h.

◆ PCA9685_MODE_1_RESTART

#define PCA9685_MODE_1_RESTART   7

Definition at line 396 of file ServoEasing.h.

◆ PCA9685_MODE_1_SLEEP

#define PCA9685_MODE_1_SLEEP   4

Definition at line 398 of file ServoEasing.h.

◆ PCA9685_PRESCALE_REGISTER

#define PCA9685_PRESCALE_REGISTER   0xFE

Definition at line 400 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 406 of file ServoEasing.h.

◆ PCA9685_SOFTWARE_RESET

#define PCA9685_SOFTWARE_RESET   6

Definition at line 392 of file ServoEasing.h.

◆ REFRESH_FREQUENCY

#define REFRESH_FREQUENCY   (MILLIS_IN_ONE_SECOND/REFRESH_INTERVAL_MILLIS)

Definition at line 173 of file ServoEasing.h.

◆ REFRESH_INTERVAL

#define REFRESH_INTERVAL   20000

Definition at line 166 of file ServoEasing.h.

◆ REFRESH_INTERVAL_MICROS

#define REFRESH_INTERVAL_MICROS   REFRESH_INTERVAL

Definition at line 171 of file ServoEasing.h.

◆ REFRESH_INTERVAL_MILLIS

#define REFRESH_INTERVAL_MILLIS   (REFRESH_INTERVAL/1000)

Definition at line 172 of file ServoEasing.h.

◆ sServoArray

#define sServoArray   ServoEasing::ServoEasingArray

Definition at line 670 of file ServoEasing.h.

◆ sServoNextPositionArray

#define sServoNextPositionArray   ServoEasing::ServoEasingNextPositionArray

Definition at line 671 of file ServoEasing.h.

◆ START_EASE_TO_SPEED

#define START_EASE_TO_SPEED   5

Definition at line 46 of file ServoEasing.h.

◆ START_UPDATE_BY_INTERRUPT

#define START_UPDATE_BY_INTERRUPT   true

Definition at line 409 of file ServoEasing.h.

◆ STR

#define STR (   x)    STR_HELPER(x)

Definition at line 734 of file ServoEasing.h.

◆ STR_HELPER

#define STR_HELPER (   x)    #x

Definition at line 733 of file ServoEasing.h.

◆ THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS

#define THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS   360

Definition at line 199 of file ServoEasing.h.

◆ VERSION_HEX_VALUE

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

Definition at line 38 of file ServoEasing.h.

◆ VERSION_SERVO_EASING

#define VERSION_SERVO_EASING   "3.2.0"

Definition at line 28 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_HEX

Definition at line 39 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_MAJOR

#define VERSION_SERVO_EASING_MAJOR   3

Definition at line 29 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_MINOR

#define VERSION_SERVO_EASING_MINOR   2

Definition at line 30 of file ServoEasing.h.

◆ VERSION_SERVO_EASING_PATCH

#define VERSION_SERVO_EASING_PATCH   0

Definition at line 31 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 1821 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 2446 of file ServoEasing.hpp.

◆ disableServoEasingInterrupt()

void disableServoEasingInterrupt ( )

Definition at line 2072 of file ServoEasing.hpp.

◆ 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 1866 of file ServoEasing.hpp.

◆ isOneServoMoving()

bool isOneServoMoving ( )

Definition at line 2366 of file ServoEasing.hpp.

◆ 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 2251 of file ServoEasing.hpp.

◆ resumeWithInterruptsAllServos()

void resumeWithInterruptsAllServos ( )

Definition at line 2398 of file ServoEasing.hpp.

◆ resumeWithoutInterruptsAllServos()

void resumeWithoutInterruptsAllServos ( )

Definition at line 2406 of file ServoEasing.hpp.

◆ 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 2355 of file ServoEasing.hpp.

◆ 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 2322 of file ServoEasing.hpp.

◆ 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 2339 of file ServoEasing.hpp.

◆ setEaseToForAllServosSynchronizeAndStartInterrupt() [1/2]

void setEaseToForAllServosSynchronizeAndStartInterrupt ( )

Definition at line 2214 of file ServoEasing.hpp.

◆ setEaseToForAllServosSynchronizeAndStartInterrupt() [2/2]

void setEaseToForAllServosSynchronizeAndStartInterrupt ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2219 of file ServoEasing.hpp.

◆ setEaseToForAllServosSynchronizeAndWaitForAllServosToStop() [1/2]

void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop ( )

Synchronize and blocking wait until all servos are stopped.

Definition at line 2227 of file ServoEasing.hpp.

◆ setEaseToForAllServosSynchronizeAndWaitForAllServosToStop() [2/2]

void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2232 of file ServoEasing.hpp.

◆ 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 2198 of file ServoEasing.hpp.

◆ setEasingTypeForMultipleServos()

void setEasingTypeForMultipleServos ( uint_fast8_t  aNumberOfServos,
uint_fast8_t  aEasingType 
)

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

Definition at line 2205 of file ServoEasing.hpp.

◆ setSpeedForAllServos()

void setSpeedForAllServos ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2286 of file ServoEasing.hpp.

◆ stopAllServos()

void stopAllServos ( )

Definition at line 2375 of file ServoEasing.hpp.

◆ synchronizeAllServosAndStartInterrupt()

void synchronizeAllServosAndStartInterrupt ( bool  aStartUpdateByInterrupt = START_UPDATE_BY_INTERRUPT)

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

Definition at line 2474 of file ServoEasing.hpp.

◆ synchronizeAllServosStartAndWaitForAllServosToStop()

void synchronizeAllServosStartAndWaitForAllServosToStop ( )

Synchronize and blocking wait until all servos are stopped.

Definition at line 2466 of file ServoEasing.hpp.

◆ synchronizeAndEaseToArrayPositions() [1/2]

void synchronizeAndEaseToArrayPositions ( )

Definition at line 2237 of file ServoEasing.hpp.

◆ synchronizeAndEaseToArrayPositions() [2/2]

void synchronizeAndEaseToArrayPositions ( uint_fast16_t  aDegreesPerSecond)

Definition at line 2242 of file ServoEasing.hpp.

◆ updateAllServos()

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

Definition at line 2417 of file ServoEasing.hpp.

◆ updateAndWaitForAllServosToStop()

void updateAndWaitForAllServosToStop ( )

Blocking wait until all servos are stopped.

Definition at line 2434 of file ServoEasing.hpp.

◆ writeAllServos()

void writeAllServos ( int  aTargetDegreeOrMicrosecond)

Definition at line 2278 of file ServoEasing.hpp.

Variable Documentation

◆ PROGMEM

const char* const easeTypeStrings [] PROGMEM

Definition at line 372 of file ServoEasing.h.