|
ServoEasing
|

Go to the source code of this file.
Macros | |
| #define | PART_OF_LINEAR_MOVEMENT 0.8 |
| #define | PART_OF_BOUNCE_MOVEMENT (1.0 - PART_OF_LINEAR_MOVEMENT) |
| #define | PART_OF_BOUNCE_MOVEMENT_HALF ((1.0 - PART_OF_LINEAR_MOVEMENT) / 2) |
| #define | OVERSHOOT_AMOUNT_MILLIS 50 |
| #define | OVERSHOOT_AMOUNT_UNITS 10 |
Functions | |
| int | clipDegreeSpecial (uint_fast8_t aDegreeToClip) |
| Clips the unsigned degree value and handles unsigned underflow. More... | |
| void | handleServoTimerInterrupt () |
| Update all servos from list and check if all servos have stopped. More... | |
| void | enableServoEasingInterrupt () |
| Timer1 is used for the Arduino Servo library. More... | |
| void | disableServoEasingInterrupt () |
| 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 | 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. More... | |
| void | setEaseToForAllServosSynchronizeAndWaitForAllServosToStop (uint_fast16_t aDegreesPerSecond) |
| void | synchronizeAndEaseToArrayPositions () |
| void | synchronizeAndEaseToArrayPositions (uint_fast16_t aDegreesPerSecond) |
| void | printArrayPositions (Print *aSerial) |
| Prints content of ServoNextPositionArray for debugging purposes. More... | |
| void | writeAllServos (int aDegreeOrMicrosecond) |
| 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... | |
| bool | isOneServoMoving () |
| void | stopAllServos () |
| void | pauseAllServos () |
| void | resumeWithInterruptsAllServos () |
| void | resumeWithoutInterruptsAllServos () |
| bool | updateAllServos () |
| void | updateAndWaitForAllServosToStop () |
| Blocking wait until all servos are stopped. More... | |
| bool | delayAndUpdateAndWaitForAllServosToStop (unsigned long aMillisDelay, bool aTerminateDelayIfAllServosStopped) |
| void | synchronizeAllServosStartAndWaitForAllServosToStop () |
| Synchronize and blocking wait until all servos are stopped. More... | |
| void | synchronizeAllServosAndStartInterrupt (bool aStartUpdateByInterrupt, bool aSynchronizeToMinimumDuration) |
| Take the longest duration in order to move all servos synchronously. More... | |
Variables | |
| const char easeTypeLinear[] | PROGMEM = "linear" |
| #define OVERSHOOT_AMOUNT_MILLIS 50 |
Definition at line 2806 of file ServoEasing.hpp.
| #define OVERSHOOT_AMOUNT_UNITS 10 |
Definition at line 2807 of file ServoEasing.hpp.
| #define PART_OF_BOUNCE_MOVEMENT (1.0 - PART_OF_LINEAR_MOVEMENT) |
Definition at line 2803 of file ServoEasing.hpp.
| #define PART_OF_BOUNCE_MOVEMENT_HALF ((1.0 - PART_OF_LINEAR_MOVEMENT) / 2) |
Definition at line 2804 of file ServoEasing.hpp.
| #define PART_OF_LINEAR_MOVEMENT 0.8 |
Definition at line 2802 of file ServoEasing.hpp.
| 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.


| void handleServoTimerInterrupt | ( | ) |
Update all servos from list and check if all servos have stopped.
Guarded by an macro in order to be able to overwrite it, e.g. for synchronizing with NeoPixel updates, which otherwise leads to servo twitching. See QuadrupedNeoPixel.cpp of QuadrupedControl example. We have (at least on Uno, Nano etc.) 100 us before the next servo period starts. See also setTimer1InterruptMarginMicros();
Definition at line 2012 of file ServoEasing.hpp.


| bool isOneServoMoving | ( | ) |
| void pauseAllServos | ( | ) |
Definition at line 2599 of file ServoEasing.hpp.
| 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 | aDegreeOrMicrosecond | ) |
| const char* const easeTypeStrings [] PROGMEM = "linear" |
Definition at line 164 of file ServoEasing.hpp.