![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
APP 4
Dependencies: mbed CRC16 mbed-rtos
MEF.h@14:9505b98c6623, 2016-02-22 (annotated)
- Committer:
- vinbel93
- Date:
- Mon Feb 22 18:06:59 2016 +0000
- Revision:
- 14:9505b98c6623
- Parent:
- 12:715af3660c73
- Child:
- 16:cf433716f8d6
fixed laurent's incompetence
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
manl2003 | 10:51ee22e230c7 | 1 | #include "APP.h" |
manl2003 | 10:51ee22e230c7 | 2 | |
manl2003 | 10:51ee22e230c7 | 3 | #pragma once |
manl2003 | 10:51ee22e230c7 | 4 | |
manl2003 | 10:51ee22e230c7 | 5 | enum STATES |
manl2003 | 10:51ee22e230c7 | 6 | { |
manl2003 | 10:51ee22e230c7 | 7 | PREAMBLE = 0, |
manl2003 | 10:51ee22e230c7 | 8 | START = 1, |
manl2003 | 10:51ee22e230c7 | 9 | TYPE = 2, |
manl2003 | 10:51ee22e230c7 | 10 | LENGTH = 3, |
manl2003 | 10:51ee22e230c7 | 11 | DATA = 4, |
manl2003 | 12:715af3660c73 | 12 | CRC16STATE = 5, |
manl2003 | 10:51ee22e230c7 | 13 | END = 6 |
manl2003 | 10:51ee22e230c7 | 14 | }; |
manl2003 | 10:51ee22e230c7 | 15 | |
manl2003 | 10:51ee22e230c7 | 16 | class MEF |
manl2003 | 10:51ee22e230c7 | 17 | { |
vinbel93 | 14:9505b98c6623 | 18 | public: |
vinbel93 | 14:9505b98c6623 | 19 | |
manl2003 | 10:51ee22e230c7 | 20 | void ReceiveBit(bool bit); |
manl2003 | 10:51ee22e230c7 | 21 | |
manl2003 | 10:51ee22e230c7 | 22 | private: |
manl2003 | 10:51ee22e230c7 | 23 | |
manl2003 | 10:51ee22e230c7 | 24 | bool startChecker(); |
manl2003 | 10:51ee22e230c7 | 25 | bool preambleChecker(); |
manl2003 | 10:51ee22e230c7 | 26 | int calculateSize(); |
manl2003 | 12:715af3660c73 | 27 | bool compareCRC(); |
manl2003 | 12:715af3660c73 | 28 | void error(); |
manl2003 | 10:51ee22e230c7 | 29 | |
manl2003 | 10:51ee22e230c7 | 30 | |
manl2003 | 10:51ee22e230c7 | 31 | STATES state; |
manl2003 | 12:715af3660c73 | 32 | bitset<16> m_InputBuffer; |
manl2003 | 12:715af3660c73 | 33 | bitset<MAX_DATA> m_BSPayload; |
manl2003 | 12:715af3660c73 | 34 | char m_CPayload[80]; |
manl2003 | 10:51ee22e230c7 | 35 | int m_Counter; |
manl2003 | 10:51ee22e230c7 | 36 | int m_DataSize; |
manl2003 | 12:715af3660c73 | 37 | unsigned short m_CRC; |
manl2003 | 10:51ee22e230c7 | 38 | }; |