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. 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) |
Take the longer duration in order to move all servos synchronously. More... | |
Variables | |
const char easeTypeLinear[] | PROGMEM = "linear" |
#define OVERSHOOT_AMOUNT_MILLIS 50 |
Definition at line 2579 of file ServoEasing.hpp.
#define OVERSHOOT_AMOUNT_UNITS 10 |
Definition at line 2580 of file ServoEasing.hpp.
#define PART_OF_BOUNCE_MOVEMENT (1.0 - PART_OF_LINEAR_MOVEMENT) |
Definition at line 2576 of file ServoEasing.hpp.
#define PART_OF_BOUNCE_MOVEMENT_HALF ((1.0 - PART_OF_LINEAR_MOVEMENT) / 2) |
Definition at line 2577 of file ServoEasing.hpp.
#define PART_OF_LINEAR_MOVEMENT 0.8 |
Definition at line 2575 of file ServoEasing.hpp.
int clipDegreeSpecial | ( | uint_fast8_t | aDegreeToClip | ) |
Clips the unsigned degree value and handles unsigned underflow.
Definition at line 1821 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 2446 of file ServoEasing.hpp.
void disableServoEasingInterrupt | ( | ) |
Definition at line 2072 of file ServoEasing.hpp.
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.
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 100 us before the next servo period starts.
Definition at line 1841 of file ServoEasing.hpp.
bool isOneServoMoving | ( | ) |
Definition at line 2366 of file ServoEasing.hpp.
void pauseAllServos | ( | ) |
Definition at line 2386 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 2251 of file ServoEasing.hpp.
void resumeWithInterruptsAllServos | ( | ) |
Definition at line 2398 of file ServoEasing.hpp.
void resumeWithoutInterruptsAllServos | ( | ) |
Definition at line 2406 of file ServoEasing.hpp.
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 2355 of file ServoEasing.hpp.
bool setEaseToForAllServos | ( | ) |
Sets target position using content of ServoEasingNextPositionArray.
Does not start interrupt/movement!
Definition at line 2322 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 2339 of file ServoEasing.hpp.
void setEaseToForAllServosSynchronizeAndStartInterrupt | ( | ) |
Definition at line 2214 of file ServoEasing.hpp.
void setEaseToForAllServosSynchronizeAndStartInterrupt | ( | uint_fast16_t | aDegreesPerSecond | ) |
Definition at line 2219 of file ServoEasing.hpp.
void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop | ( | ) |
Synchronize and blocking wait until all servos are stopped.
Definition at line 2227 of file ServoEasing.hpp.
void setEaseToForAllServosSynchronizeAndWaitForAllServosToStop | ( | uint_fast16_t | aDegreesPerSecond | ) |
Definition at line 2232 of file ServoEasing.hpp.
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.
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.
void setSpeedForAllServos | ( | uint_fast16_t | aDegreesPerSecond | ) |
Definition at line 2286 of file ServoEasing.hpp.
void stopAllServos | ( | ) |
Definition at line 2375 of file ServoEasing.hpp.
void synchronizeAllServosAndStartInterrupt | ( | bool | aStartUpdateByInterrupt | ) |
Take the longer duration in order to move all servos synchronously.
Definition at line 2474 of file ServoEasing.hpp.
void synchronizeAllServosStartAndWaitForAllServosToStop | ( | ) |
Synchronize and blocking wait until all servos are stopped.
Definition at line 2466 of file ServoEasing.hpp.
void synchronizeAndEaseToArrayPositions | ( | ) |
Definition at line 2237 of file ServoEasing.hpp.
void synchronizeAndEaseToArrayPositions | ( | uint_fast16_t | aDegreesPerSecond | ) |
Definition at line 2242 of file ServoEasing.hpp.
bool updateAllServos | ( | ) |
Definition at line 2417 of file ServoEasing.hpp.
void updateAndWaitForAllServosToStop | ( | ) |
Blocking wait until all servos are stopped.
Definition at line 2434 of file ServoEasing.hpp.
void writeAllServos | ( | int | aDegreeOrMicrosecond | ) |
Definition at line 2278 of file ServoEasing.hpp.
const char* const easeTypeStrings [] PROGMEM = "linear" |
Definition at line 165 of file ServoEasing.hpp.