RSeries astromech firmware
|
#include "ReelTwo.h"
#include "core/SetupEvent.h"
#include "core/AnimatedEvent.h"
#include "core/CommandEvent.h"
#include "ServoSequencer.h"
Go to the source code of this file.
Classes | |
class | AnimationPlayer |
Player of animation scripts. More... | |
Macros | |
#define | ANIMATION_FUNC_DECL(name) |
#define | ANIMATION(name) ANIMATION_FUNC_DECL(name) { enum { _firstStep = __COUNTER__ }; |
#define | DO_START() UNUSED_ARG(num) UNUSED_ARG(elapsedMillis) switch (step+1) { |
#define | DO_CASE() case __COUNTER__-_firstStep: |
#define | DO_LABEL(label) enum { label = __COUNTER__-_firstStep }; case label: { return true; } |
#define | DO_ONCE_LABEL(label, p) enum { label = __COUNTER__-_firstStep }; case label: { p; return true; } |
#define | DO_ONCE(p) DO_CASE() { p; return true; } |
#define | DO_ONCE_AND_WAIT(p, ms) DO_CASE() { if (!animation.fRepeatStep) { p; } return (ms < elapsedMillis); } |
#define | DO_FOREVER(p) DO_CASE() { p; return false; } |
#define | DO_DURATION(ms, p) DO_CASE() { if (animation.getCurrentTimeMillis() < ms) { p; return false; } return true; } |
#define | DO_DURATION_STEP(ms, p) DO_CASE() { if (elapsedMillis < ms) { p; return false; } return true; } |
#define | DO_WAIT_MILLIS(ms) DO_CASE() { return (ms < elapsedMillis); } |
#define | DO_WAIT_SEC(sec) DO_CASE() { return (sec*1000L < long(elapsedMillis)); } |
#define | DO_GOTO(label) DO_CASE() { animation.gotoStep(label); return -1; } |
#define | DO_WHILE(cond, label) DO_CASE() { if (cond) { animation.gotoStep(label); return -1; } return true; } |
#define | DO_SEQUENCE(seq, mask) DO_CASE() { SEQUENCE_PLAY_ONCE(*animation.fServoSequencer, seq, mask); return true; } |
#define | DO_SEQUENCE_SPEED(seq, mask, speed) DO_CASE() { SEQUENCE_PLAY_ONCE_SPEED(*animation.fServoSequencer, seq, mask, speed); return true; } |
#define | DO_SEQUENCE_VARSPEED(seq, mask, minspeed, maxspeed) DO_CASE() { SEQUENCE_PLAY_ONCE_VARSPEED(*animation.fServoSequencer, seq, mask, minspeed, maxspeed); return true; } |
#define | DO_SEQUENCE_RANDOM_STEP(seq, mask) DO_CASE() { SEQUENCE_PLAY_RANDOM_STEP(*animation.fServoSequencer, seq, mask); return true; } |
#define | DO_WAIT_SEQUENCE() DO_CASE() { return animation.fServoSequencer->isFinished(); } |
#define | DO_WHILE_SEQUENCE(label) DO_CASE() { if (!animation.fServoSequencer->isFinished()) { animation.gotoStep(label); return -1; } return true; } |
#define | DO_COMMAND(cmd) DO_CASE() { CommandEvent::process(cmd); return true; } |
#define | DO_COMMAND_AND_WAIT(cmd, ms) DO_CASE() { if (!animation.fRepeatStep) { CommandEvent::process(cmd); } return (ms < elapsedMillis); } |
#define | DO_MARCDUINO(cmd) DO_CASE() { Marcduino::send(cmd); return true; } |
#define | DO_MARCDUINO_AND_WAIT(cmd, ms) DO_CASE() { if (!animation.fRepeatStep) { Marcduino::send(cmd); } return (ms < elapsedMillis); } |
#define | DO_RESET(p) case 0: { p; return true; } |
#define | DO_END() default: animation.end(); return false; } } |
#define | ANIMATION_PLAY_ONCE(player, name) player.animateOnce(Animation_##name) |
Typedefs | |
typedef signed char(* | AnimationStep) (class AnimationPlayer &animation, unsigned step, unsigned long num, unsigned long elapsedMillis) |
#define ANIMATION | ( | name | ) | ANIMATION_FUNC_DECL(name) { enum { _firstStep = __COUNTER__ }; |
#define ANIMATION_FUNC_DECL | ( | name | ) |
#define ANIMATION_PLAY_ONCE | ( | player, | |
name | |||
) | player.animateOnce(Animation_##name) |
#define DO_CASE | ( | ) | case __COUNTER__-_firstStep: |
#define DO_COMMAND | ( | cmd | ) | DO_CASE() { CommandEvent::process(cmd); return true; } |
#define DO_COMMAND_AND_WAIT | ( | cmd, | |
ms | |||
) | DO_CASE() { if (!animation.fRepeatStep) { CommandEvent::process(cmd); } return (ms < elapsedMillis); } |
#define DO_DURATION | ( | ms, | |
p | |||
) | DO_CASE() { if (animation.getCurrentTimeMillis() < ms) { p; return false; } return true; } |
#define DO_DURATION_STEP | ( | ms, | |
p | |||
) | DO_CASE() { if (elapsedMillis < ms) { p; return false; } return true; } |
#define DO_END | ( | ) | default: animation.end(); return false; } } |
#define DO_FOREVER | ( | p | ) | DO_CASE() { p; return false; } |
#define DO_GOTO | ( | label | ) | DO_CASE() { animation.gotoStep(label); return -1; } |
#define DO_LABEL | ( | label | ) | enum { label = __COUNTER__-_firstStep }; case label: { return true; } |
#define DO_MARCDUINO | ( | cmd | ) | DO_CASE() { Marcduino::send(cmd); return true; } |
#define DO_MARCDUINO_AND_WAIT | ( | cmd, | |
ms | |||
) | DO_CASE() { if (!animation.fRepeatStep) { Marcduino::send(cmd); } return (ms < elapsedMillis); } |
#define DO_ONCE | ( | p | ) | DO_CASE() { p; return true; } |
#define DO_ONCE_AND_WAIT | ( | p, | |
ms | |||
) | DO_CASE() { if (!animation.fRepeatStep) { p; } return (ms < elapsedMillis); } |
#define DO_ONCE_LABEL | ( | label, | |
p | |||
) | enum { label = __COUNTER__-_firstStep }; case label: { p; return true; } |
#define DO_RESET | ( | p | ) | case 0: { p; return true; } |
#define DO_SEQUENCE | ( | seq, | |
mask | |||
) | DO_CASE() { SEQUENCE_PLAY_ONCE(*animation.fServoSequencer, seq, mask); return true; } |
#define DO_SEQUENCE_RANDOM_STEP | ( | seq, | |
mask | |||
) | DO_CASE() { SEQUENCE_PLAY_RANDOM_STEP(*animation.fServoSequencer, seq, mask); return true; } |
#define DO_SEQUENCE_SPEED | ( | seq, | |
mask, | |||
speed | |||
) | DO_CASE() { SEQUENCE_PLAY_ONCE_SPEED(*animation.fServoSequencer, seq, mask, speed); return true; } |
#define DO_SEQUENCE_VARSPEED | ( | seq, | |
mask, | |||
minspeed, | |||
maxspeed | |||
) | DO_CASE() { SEQUENCE_PLAY_ONCE_VARSPEED(*animation.fServoSequencer, seq, mask, minspeed, maxspeed); return true; } |
#define DO_START | ( | ) | UNUSED_ARG(num) UNUSED_ARG(elapsedMillis) switch (step+1) { |
#define DO_WAIT_MILLIS | ( | ms | ) | DO_CASE() { return (ms < elapsedMillis); } |
#define DO_WAIT_SEC | ( | sec | ) | DO_CASE() { return (sec*1000L < long(elapsedMillis)); } |
#define DO_WAIT_SEQUENCE | ( | ) | DO_CASE() { return animation.fServoSequencer->isFinished(); } |
#define DO_WHILE | ( | cond, | |
label | |||
) | DO_CASE() { if (cond) { animation.gotoStep(label); return -1; } return true; } |
#define DO_WHILE_SEQUENCE | ( | label | ) | DO_CASE() { if (!animation.fServoSequencer->isFinished()) { animation.gotoStep(label); return -1; } return true; } |
typedef signed char(* AnimationStep) (class AnimationPlayer &animation, unsigned step, unsigned long num, unsigned long elapsedMillis) |