Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Motor_XYZ_UI_SPI_I2C_5mag by
envelopetracker.h
00001 #ifndef ENVELOPETRACKER_H 00002 #define ENVELOPETRACKER_H 00003 00004 #include "envelope.h" 00005 #include <list> 00006 class EnvelopeTracker 00007 { 00008 public: 00009 EnvelopeTracker(); 00010 00011 // parsing 00012 void parse(char *buf, int bufLength); 00013 00014 Envelope* getEnvelope(){ 00015 Envelope* ret = NULL; 00016 if(envelopeListIndexFront != -1){ 00017 ret = envelopeList[envelopeListIndexFront++]; 00018 envelopeListIndexFront %= envelopeListLength; 00019 if(envelopeListIndexFront == envelopeListIndex) envelopeListIndexFront = -1; 00020 } 00021 return ret; 00022 } 00023 int bufferDataLength(); 00024 00025 void resetBuffer(); 00026 00027 void setEnvelope(const Envelope &value); 00028 00029 void setBufferLength(int value); 00030 ~EnvelopeTracker(); 00031 00032 private: 00033 // check Header 00034 bool testHeader(); 00035 00036 // check Footer 00037 bool testFooter(); 00038 00039 // test XOR 00040 bool testXOR();// set xindex as headerIndex 00041 00042 00043 // current header index 00044 int currentHeaderIndex; 00045 // current footer index 00046 int currentFooterIndex; 00047 int currentDataIndex; 00048 // index 00049 int currentIndex; 00050 // array 00051 char * bufferArray; 00052 int bufferLength; 00053 int bufferTailIndex; 00054 00055 Envelope** envelopeList; 00056 int envelopeListLength; 00057 int envelopeListIndex; 00058 int envelopeListIndexFront; 00059 Envelope envelope; 00060 int envelopeLength; 00061 int envelopeDataLength; 00062 int headerLength; 00063 }; 00064 00065 #endif // ENVELOPETRACKER_H 00066
Generated on Fri Jul 15 2022 03:22:24 by
