Firmware for Arduino | PLEN Project Company Inc.
Interpreter.h
Go to the documentation of this file.
1 
8 #pragma once
9 
10 #ifndef PLEN2_INTERPRETER_H
11 #define PLEN2_INTERPRETER_H
12 
13 
14 #include <stdint.h>
15 
16 namespace PLEN2
17 {
18  class Interpreter;
19  class MotionController;
20 }
21 
30 {
31 public:
35  struct Code
36  {
37  uint8_t slot;
38  uint8_t loop_count;
39  };
40 
47  enum { QUEUE_SIZE = 32 };
48 
49 
55  Interpreter(MotionController& motion_ctrl);
56 
66  bool pushCode(const Code& code);
67 
79  bool popCode();
80 
86  bool ready();
87 
91  void reset();
92 
93 
94 private:
95  Code m_code_queue[QUEUE_SIZE];
96  uint8_t m_queue_begin;
97  uint8_t m_queue_end;
98  MotionController* m_motion_ctrl_ptr;
99 };
100 
101 #endif // PLEN2_INTERPRETER_H
Definition: AccelerationGyroSensor.h:16
bool popCode()
Run a code in heading of the queue.
Interpreter(MotionController &motion_ctrl)
Constructor.
uint8_t loop_count
Loop count. (Using 255 as infinity.)
Definition: Interpreter.h:38
uint8_t slot
Slot number of a motion.
Definition: Interpreter.h:37
Definition: Interpreter.h:47
bool pushCode(const Code &code)
Reserve to run a code.
void reset()
Reset the interpreter.
Management class of a motion.
Definition: MotionController.h:36
Management class of interpreter.
Definition: Interpreter.h:29
Code struct.
Definition: Interpreter.h:35
bool ready()
Decide if there are codes which are reserved to run.