A scripting environment used to define precise output/input temporal relationships.
Dependencies: SMARTWAV mbed HelloWorld
Dependents: perturbRoom_legacy
Fork of HelloWorld by
Diff: behave.h
- Revision:
- 4:34aca2142df9
- Parent:
- 2:298679fff37c
--- a/behave.h Sat Jul 19 03:03:36 2014 +0000 +++ b/behave.h Thu Sep 25 23:42:30 2014 +0000 @@ -23,6 +23,7 @@ #define NUMPORTS 8 +#define INPUTCHARBUFFERSIZE 3072 class event; //we foreward declare this because of class interdependencies @@ -385,6 +386,25 @@ action* actionPtr; }; +class blockBuffer { + +public: + blockBuffer(); + bool addLine(char* input, int numChars); + string getNextLine(); + int16_t linesAvailable(); + bool empty(); + void resetBuffer(); + +private: + //__attribute((section("AHBSRAM1"),aligned)) char charBuffer[INPUTCHARBUFFERSIZE]; + char charBuffer[INPUTCHARBUFFERSIZE]; + int16_t bufferWritePos; + int16_t bufferReadPos; + int16_t _linesAvailable; + +}; + //Parser for the incoming text. The parser is called when a line terminates with a semicolon (;). //Only the final line in a callback block should have a semicolon. class scriptStream { @@ -403,13 +423,15 @@ int getRandomParam(string expression); + + private: int currentTriggerPort; int currentTriggerDir; int currentPort; int currentFunction; - + string tmpLine; vector<string> tokens; @@ -426,7 +448,8 @@ vector<intVariable*> globalVariables; vector<event*> tmpEventPtrArray; vector<functionItem*> functionArray; //any blocks declared outsite callback blocks are stored here - list<string> currentBlock; + //list<string> currentBlock; + blockBuffer currentBlock; digitalPort** portVector;