|
RSeries astromech firmware
|
|
Go to the documentation of this file.
8 #define MARCDUINO_ANIMATION(name, marc) \
9 ANIMATION_FUNC_DECL(name); \
10 const char _marc_msg_##name[] PROGMEM = #marc; \
11 Marcduino Marc_##name(Animation_##name, _marc_msg_##name); \
14 #define MARCDUINO_ACTION(name, marc, p) \
15 MARCDUINO_ANIMATION(name, marc) \
27 fAnimation(animation),
33 (*tail())->fNext =
this;
40 for (
Marcduino* marc = *head(); marc != NULL; marc = marc->fNext)
42 int len = strlen_P(marc->fMarc);
43 if (strncmp_P(cmd, marc->fMarc, len) == 0 ||
44 (marc->fMarc[0] ==
'@' && isdigit(cmd[0]) && strncmp_P(cmd, marc->fMarc+1, len-1) == 0 && len--))
47 if (animation != NULL)
49 *command() = cmd + len;
56 if (!found && *cmd ==
'@')
79 static void send(
const char* cmd)
102 static const char** command()
104 static const char* sCmd;
145 void setStream(Stream* stream, Stream* outStream =
nullptr)
148 fOutStream = outStream;
153 if (fStream !=
nullptr && fStream->available())
155 int ch = fStream->read();
159 if (fOutStream !=
nullptr)
163 fOutStream->write(&buf, 1);
167 fBuffer[fPos] =
'\0';
169 if (*fBuffer !=
'\0')
176 fBuffer[fPos++] = ch;
184 Stream* fOutStream =
nullptr;
186 char fBuffer[BUFFER_SIZE];
MarcduinoSerial(AnimationPlayer &player)
Definition: Marcduino.h:138
Player of animation scripts.
Definition: Animation.h:79
Base class for all animated devices. AnimatedEvent::animate() is called for each device once through ...
Definition: AnimatedEvent.h:18
static void send_end()
Definition: ReelTwoSMQ.h:463
static bool sendTopic(const smq_id id)
Definition: ReelTwoSMQ.h:155
static const char * getCommand()
Definition: Marcduino.h:92
static JawaCommanderBase * get()
Definition: JawaCommander.h:173
static void processCommand(AnimationPlayer &player, const char *cmd)
Definition: Marcduino.h:37
Definition: Marcduino.h:121
Marcduino(AnimationStep animation, const char *marc)
Definition: Marcduino.h:25
static void send(const char *cmd)
Definition: Marcduino.h:79
MarcduinoSerial(Stream *stream, AnimationPlayer &player)
Definition: Marcduino.h:131
Definition: JawaCommander.h:6
static void send(PROGMEMString cmd)
Definition: Marcduino.h:66
virtual void animate()
Subclasses must implement this function to run through a single frame of animation/activity.
Definition: Marcduino.h:151
Definition: Marcduino.h:22
signed char(* AnimationStep)(class AnimationPlayer &animation, unsigned step, unsigned long num, unsigned long elapsedMillis)
Definition: Animation.h:10
void setStream(Stream *stream, Stream *outStream=nullptr)
Definition: Marcduino.h:145
const typedef __FlashStringHelper * PROGMEMString
Definition: ReelTwo.h:235
#define UNUSED_ARG(arg)
Definition: ReelTwo.h:25
MarcduinoSerial(HardwareSerial &serial, AnimationPlayer &player)
Definition: Marcduino.h:124
#define SizeOfArray(arr)
Definition: ReelTwo.h:213
static void send_string(const char *str)
Definition: ReelTwoSMQ.h:106
void animateOnce(AnimationStep animation)
Play the specified animation script once.
Definition: Animation.h:135
void process(const char ch)
Append a single character to the parsers input buffer.
Definition: JawaCommander.h:139