|
ServoEasing
|
#include <Servo.h>#include <stdarg.h>

Go to the source code of this file.
Classes | |
| class | ServoEasing |
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 |
| #define areInterruptsActive | ( | ) | ServoEasing::areInterruptsActive() |
Definition at line 727 of file ServoEasing.h.
| #define CALL_STYLE_BOUNCING_OUT_IN 0xC0 |
Definition at line 330 of file ServoEasing.h.
| #define CALL_STYLE_DIRECT 0x00 |
Definition at line 326 of file ServoEasing.h.
| #define CALL_STYLE_IN 0x00 |
Definition at line 327 of file ServoEasing.h.
| #define CALL_STYLE_IN_OUT 0x80 |
Definition at line 329 of file ServoEasing.h.
| #define CALL_STYLE_MASK 0xC0 |
Definition at line 332 of file ServoEasing.h.
| #define CALL_STYLE_OUT 0x40 |
Definition at line 328 of file ServoEasing.h.
| #define DEFAULT_MICROSECONDS_FOR_0_DEGREE 544 |
Definition at line 247 of file ServoEasing.h.
| #define DEFAULT_MICROSECONDS_FOR_135_DEGREE (2400 - ((2400 - 544) / 4)) |
Definition at line 250 of file ServoEasing.h.
| #define DEFAULT_MICROSECONDS_FOR_180_DEGREE 2400 |
Definition at line 251 of file ServoEasing.h.
| #define DEFAULT_MICROSECONDS_FOR_45_DEGREE (544 + ((2400 - 544) / 4)) |
Definition at line 248 of file ServoEasing.h.
| #define DEFAULT_MICROSECONDS_FOR_90_DEGREE (544 + ((2400 - 544) / 2)) |
Definition at line 249 of file ServoEasing.h.
| #define DEFAULT_PCA9685_UNITS_FOR_0_DEGREE 111 |
Definition at line 254 of file ServoEasing.h.
| #define DEFAULT_PCA9685_UNITS_FOR_135_DEGREE (491 - ((491 - 111) / 4)) |
Definition at line 257 of file ServoEasing.h.
| #define DEFAULT_PCA9685_UNITS_FOR_180_DEGREE 491 |
Definition at line 258 of file ServoEasing.h.
| #define DEFAULT_PCA9685_UNITS_FOR_45_DEGREE (111 + ((491 - 111) / 4)) |
Definition at line 255 of file ServoEasing.h.
| #define DEFAULT_PCA9685_UNITS_FOR_90_DEGREE (111 + ((491 - 111) / 2)) |
Definition at line 256 of file ServoEasing.h.
| #define DEFAULT_PULSE_WIDTH 1500 |
Definition at line 183 of file ServoEasing.h.
| #define DO_NOT_START_UPDATE_BY_INTERRUPT false |
Definition at line 449 of file ServoEasing.h.
| #define EASE_BACK_BOUNCING 0xCA |
Definition at line 386 of file ServoEasing.h.
| #define EASE_BACK_IN 0x0A |
Definition at line 383 of file ServoEasing.h.
| #define EASE_BACK_IN_OUT 0x8A |
Definition at line 385 of file ServoEasing.h.
| #define EASE_BACK_OUT 0x4A |
Definition at line 384 of file ServoEasing.h.
| #define EASE_BOUNCE_IN 0x4C |
Definition at line 398 of file ServoEasing.h.
| #define EASE_BOUNCE_OUT 0x0C |
Definition at line 399 of file ServoEasing.h.
| #define EASE_CIRCULAR_BOUNCING 0xC9 |
Definition at line 379 of file ServoEasing.h.
| #define EASE_CIRCULAR_IN 0x09 |
Definition at line 376 of file ServoEasing.h.
| #define EASE_CIRCULAR_IN_OUT 0x89 |
Definition at line 378 of file ServoEasing.h.
| #define EASE_CIRCULAR_OUT 0x49 |
Definition at line 377 of file ServoEasing.h.
| #define EASE_CUBIC_BOUNCING 0xC2 |
Definition at line 348 of file ServoEasing.h.
| #define EASE_CUBIC_IN 0x02 |
Definition at line 345 of file ServoEasing.h.
| #define EASE_CUBIC_IN_OUT 0x82 |
Definition at line 347 of file ServoEasing.h.
| #define EASE_CUBIC_OUT 0x42 |
Definition at line 346 of file ServoEasing.h.
| #define EASE_DUMMY_MOVE 0x07 |
Definition at line 366 of file ServoEasing.h.
| #define EASE_ELASTIC_BOUNCING 0xCB |
Definition at line 393 of file ServoEasing.h.
| #define EASE_ELASTIC_IN 0x0B |
Definition at line 390 of file ServoEasing.h.
| #define EASE_ELASTIC_IN_OUT 0x8B |
Definition at line 392 of file ServoEasing.h.
| #define EASE_ELASTIC_OUT 0x4B |
Definition at line 391 of file ServoEasing.h.
| #define EASE_FUNCTION_DEGREE_INDICATOR_OFFSET 200 |
Definition at line 318 of file ServoEasing.h.
| #define EASE_FUNCTION_DEGREE_THRESHOLD (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET - 180) |
Definition at line 319 of file ServoEasing.h.
| #define EASE_FUNCTION_MICROSECONDS_INDICATOR_OFFSET (EASE_FUNCTION_DEGREE_INDICATOR_OFFSET + 200) |
Definition at line 320 of file ServoEasing.h.
| #define EASE_LINEAR 0x00 |
Definition at line 335 of file ServoEasing.h.
| #define EASE_PRECISION_IN 0x0D |
Definition at line 403 of file ServoEasing.h.
| #define EASE_PRECISION_OUT 0x4D |
Definition at line 404 of file ServoEasing.h.
| #define EASE_QUADRATIC_BOUNCING 0xC1 |
Definition at line 341 of file ServoEasing.h.
| #define EASE_QUADRATIC_IN 0x01 |
Definition at line 338 of file ServoEasing.h.
| #define EASE_QUADRATIC_IN_OUT 0x81 |
Definition at line 340 of file ServoEasing.h.
| #define EASE_QUADRATIC_OUT 0x41 |
Definition at line 339 of file ServoEasing.h.
| #define EASE_QUARTIC_BOUNCING 0xC3 |
Definition at line 355 of file ServoEasing.h.
| #define EASE_QUARTIC_IN 0x03 |
Definition at line 352 of file ServoEasing.h.
| #define EASE_QUARTIC_IN_OUT 0x83 |
Definition at line 354 of file ServoEasing.h.
| #define EASE_QUARTIC_OUT 0x43 |
Definition at line 353 of file ServoEasing.h.
| #define EASE_SINE_BOUNCING 0xC8 |
Definition at line 372 of file ServoEasing.h.
| #define EASE_SINE_IN 0x08 |
Definition at line 369 of file ServoEasing.h.
| #define EASE_SINE_IN_OUT 0x88 |
Definition at line 371 of file ServoEasing.h.
| #define EASE_SINE_OUT 0x48 |
Definition at line 370 of file ServoEasing.h.
| #define EASE_TYPE_MASK 0x0F |
Definition at line 333 of file ServoEasing.h.
| #define EASE_USER_BOUNCING 0xC6 |
Definition at line 363 of file ServoEasing.h.
| #define EASE_USER_DIRECT 0x06 |
Definition at line 359 of file ServoEasing.h.
| #define EASE_USER_IN 0x06 |
Definition at line 360 of file ServoEasing.h.
| #define EASE_USER_IN_OUT 0x86 |
Definition at line 362 of file ServoEasing.h.
| #define EASE_USER_OUT 0x46 |
Definition at line 361 of file ServoEasing.h.
| #define ENABLE_EASE_BACK |
Definition at line 294 of file ServoEasing.h.
| #define ENABLE_EASE_BOUNCE |
Definition at line 296 of file ServoEasing.h.
| #define ENABLE_EASE_CIRCULAR |
Definition at line 293 of file ServoEasing.h.
| #define ENABLE_EASE_CUBIC |
Definition at line 288 of file ServoEasing.h.
| #define ENABLE_EASE_ELASTIC |
Definition at line 295 of file ServoEasing.h.
| #define ENABLE_EASE_PRECISION |
Definition at line 297 of file ServoEasing.h.
| #define ENABLE_EASE_QUADRATIC |
Definition at line 287 of file ServoEasing.h.
| #define ENABLE_EASE_QUARTIC |
Definition at line 289 of file ServoEasing.h.
| #define ENABLE_EASE_SINE |
Definition at line 292 of file ServoEasing.h.
| #define ENABLE_EASE_USER |
Definition at line 290 of file ServoEasing.h.
| #define INVALID_SERVO 255 |
Definition at line 195 of file ServoEasing.h.
| #define MAX_EASING_SERVOS 12 |
Definition at line 178 of file ServoEasing.h.
| #define MAXIMUM_PULSE_WIDTH 3500 |
Definition at line 243 of file ServoEasing.h.
| #define mCurrentMicrosecondsOrUnits mLastTargetMicrosecondsOrUnits |
Definition at line 451 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_HALF (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 100) |
Definition at line 276 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_MAX (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 200) |
Definition at line 275 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_CLOCKWISE_QUARTER (MICROSECONDS_FOR_ROTATING_SERVO_STOP - 50) |
Definition at line 277 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_HALF (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 100) |
Definition at line 279 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_MAX (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 200) |
Definition at line 278 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_COUNTER_CLOCKWISE_QUARTER (MICROSECONDS_FOR_ROTATING_SERVO_STOP + 50) |
Definition at line 280 of file ServoEasing.h.
| #define MICROSECONDS_FOR_ROTATING_SERVO_STOP 1500 |
Definition at line 270 of file ServoEasing.h.
| #define MILLIS_IN_ONE_SECOND 1000L |
Definition at line 45 of file ServoEasing.h.
| #define MINIMUM_PULSE_WIDTH 400 |
Definition at line 240 of file ServoEasing.h.
| #define PCA9685_ACTUAL_CLOCK_FREQUENCY 25000000L |
Definition at line 442 of file ServoEasing.h.
| #define PCA9685_DEFAULT_ADDRESS 0x40 |
Definition at line 431 of file ServoEasing.h.
| #define PCA9685_FIRST_PWM_REGISTER 0x06 |
Definition at line 438 of file ServoEasing.h.
| #define PCA9685_GENERAL_CALL_ADDRESS 0x00 |
Definition at line 429 of file ServoEasing.h.
| #define PCA9685_MAX_CHANNELS 16 |
Definition at line 432 of file ServoEasing.h.
| #define PCA9685_MODE1_EXTCLK 6 |
Definition at line 437 of file ServoEasing.h.
| #define PCA9685_MODE1_REGISTER 0x0 |
Definition at line 433 of file ServoEasing.h.
| #define PCA9685_MODE_1_AUTOINCREMENT 5 |
Definition at line 435 of file ServoEasing.h.
| #define PCA9685_MODE_1_RESTART 7 |
Definition at line 434 of file ServoEasing.h.
| #define PCA9685_MODE_1_SLEEP 4 |
Definition at line 436 of file ServoEasing.h.
| #define PCA9685_PRESCALE_REGISTER 0xFE |
Definition at line 439 of file ServoEasing.h.
| #define PCA9685_PRESCALER_FOR_20_MS ((PCA9685_ACTUAL_CLOCK_FREQUENCY /(4096L * 50)) - 1) |
Definition at line 445 of file ServoEasing.h.
| #define PCA9685_SOFTWARE_RESET 6 |
Definition at line 430 of file ServoEasing.h.
| #define SERVO_REFRESH_FREQUENCY (MILLIS_IN_ONE_SECOND/SERVO_REFRESH_INTERVAL_MILLIS) |
Definition at line 198 of file ServoEasing.h.
| #define SERVO_REFRESH_INTERVAL_MICROS 20000 |
Definition at line 192 of file ServoEasing.h.
| #define SERVO_REFRESH_INTERVAL_MILLIS (SERVO_REFRESH_INTERVAL_MICROS/1000) |
Definition at line 197 of file ServoEasing.h.
| #define sServoArray ServoEasing::ServoEasingArray |
Definition at line 728 of file ServoEasing.h.
| #define sServoNextPositionArray ServoEasing::ServoEasingNextPositionArray |
Definition at line 729 of file ServoEasing.h.
| #define START_EASE_TO_SPEED 5 |
Definition at line 51 of file ServoEasing.h.
| #define START_UPDATE_BY_INTERRUPT true |
Definition at line 448 of file ServoEasing.h.
| #define STR | ( | x | ) | STR_HELPER(x) |
Definition at line 797 of file ServoEasing.h.
| #define STR_HELPER | ( | x | ) | #x |
Definition at line 796 of file ServoEasing.h.
| #define THRESHOLD_VALUE_FOR_INTERPRETING_VALUE_AS_MICROSECONDS 360 |
Definition at line 224 of file ServoEasing.h.
| #define VERSION_HEX_VALUE | ( | major, | |
| minor, | |||
| patch | |||
| ) | ((major << 16) | (minor << 8) | (patch)) |
Definition at line 41 of file ServoEasing.h.
| #define VERSION_SERVO_EASING "3.6.0" |
Definition at line 27 of file ServoEasing.h.
| #define VERSION_SERVO_EASING_HEX VERSION_HEX_VALUE(VERSION_SERVO_EASING_MAJOR, VERSION_SERVO_EASING_MINOR, VERSION_SERVO_EASING_PATCH) |
Definition at line 42 of file ServoEasing.h.
| #define VERSION_SERVO_EASING_MAJOR 3 |
Definition at line 28 of file ServoEasing.h.
| #define VERSION_SERVO_EASING_MINOR 6 |
Definition at line 29 of file ServoEasing.h.
| #define VERSION_SERVO_EASING_PATCH 0 |
Definition at line 30 of file ServoEasing.h.
| bool checkI2CConnection | ( | uint8_t | aI2CAddress, |
| Stream * | aSerial | ||
| ) |
| int clipDegreeSpecial | ( | uint_fast8_t | aDegreeToClip | ) |
Clips the unsigned degree value and handles unsigned underflow.
Definition at line 1991 of file ServoEasing.hpp.
| bool delayAndUpdateAndWaitForAllServosToStop | ( | unsigned long | aMillisDelay, |
| bool | aTerminateDelayIfAllServosStopped | ||
| ) |
| aMillisDelay | the milliseconds for blocking wait and update |
| aTerminateDelayIfAllServosStopped | if true, function returns before aMillisDelay if all servos are stopped |
Definition at line 2662 of file ServoEasing.hpp.

| void disableServoEasingInterrupt | ( | ) |
| 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.


| bool isOneServoMoving | ( | ) |
| void printArrayPositions | ( | Print * | aSerial | ) |
Prints content of ServoNextPositionArray for debugging purposes.
| aSerial | The Print object on which to write, for Arduino you can use &Serial. |
Definition at line 2440 of file ServoEasing.hpp.
| void resumeWithInterruptsAllServos | ( | ) |
| void resumeWithoutInterruptsAllServos | ( | ) |
| 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!
Definition at line 2568 of file ServoEasing.hpp.

| bool setEaseToForAllServos | ( | ) |
Sets target position using content of ServoEasingNextPositionArray.
Does not start interrupt/movement!
Definition at line 2535 of file ServoEasing.hpp.


| 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!
Definition at line 2552 of file ServoEasing.hpp.

| void setEaseToForAllServosSynchronizeAndStartInterrupt | ( | ) |
| void setEaseToForAllServosSynchronizeAndStartInterrupt | ( | uint_fast16_t | aDegreesPerSecond | ) |
| 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.

| void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop | ( | uint_fast16_t | aDegreesPerSecond | ) |
| 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.

| 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.

| void setSpeedForAllServos | ( | uint_fast16_t | aDegreesPerSecond | ) |
Definition at line 2475 of file ServoEasing.hpp.
| void stopAllServos | ( | ) |
| void synchronizeAllServosAndStartInterrupt | ( | bool | aStartUpdateByInterrupt, |
| bool | aSynchronizeToMinimumDuration | ||
| ) |
Take the longest duration in order to move all servos synchronously.
| aSynchronizeToMinimumDuration | - Take the shortest duration for synchronizing |
Definition at line 2691 of file ServoEasing.hpp.


| void synchronizeAllServosStartAndWaitForAllServosToStop | ( | ) |
Synchronize and blocking wait until all servos are stopped.
Definition at line 2682 of file ServoEasing.hpp.


| void synchronizeAndEaseToArrayPositions | ( | ) |
| void synchronizeAndEaseToArrayPositions | ( | uint_fast16_t | aDegreesPerSecond | ) |
| bool updateAllServos | ( | ) |
Definition at line 2630 of file ServoEasing.hpp.


| void updateAndWaitForAllServosToStop | ( | ) |
Blocking wait until all servos are stopped.
Definition at line 2650 of file ServoEasing.hpp.


| void writeAllServos | ( | int | aTargetDegreeOrMicrosecond | ) |
| const char* const easeTypeStrings [] PROGMEM |
Definition at line 410 of file ServoEasing.h.