APP 4
Dependencies: mbed CRC16 mbed-rtos
MEF.h@12:715af3660c73, 2016-02-22 (annotated)
- Committer:
- manl2003
- Date:
- Mon Feb 22 16:56:48 2016 +0000
- Revision:
- 12:715af3660c73
- Parent:
- 10:51ee22e230c7
- Child:
- 14:9505b98c6623
Premi?re it?ration de la MEF
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 | { |
manl2003 | 10:51ee22e230c7 | 18 | MEF(); |
manl2003 | 10:51ee22e230c7 | 19 | void ReceiveBit(bool bit); |
manl2003 | 10:51ee22e230c7 | 20 | |
manl2003 | 10:51ee22e230c7 | 21 | private: |
manl2003 | 10:51ee22e230c7 | 22 | |
manl2003 | 10:51ee22e230c7 | 23 | bool startChecker(); |
manl2003 | 10:51ee22e230c7 | 24 | bool preambleChecker(); |
manl2003 | 10:51ee22e230c7 | 25 | int calculateSize(); |
manl2003 | 12:715af3660c73 | 26 | bool compareCRC(); |
manl2003 | 12:715af3660c73 | 27 | void error(); |
manl2003 | 10:51ee22e230c7 | 28 | |
manl2003 | 10:51ee22e230c7 | 29 | |
manl2003 | 10:51ee22e230c7 | 30 | STATES state; |
manl2003 | 12:715af3660c73 | 31 | bitset<16> m_InputBuffer; |
manl2003 | 12:715af3660c73 | 32 | bitset<MAX_DATA> m_BSPayload; |
manl2003 | 12:715af3660c73 | 33 | char m_CPayload[80]; |
manl2003 | 10:51ee22e230c7 | 34 | int m_Counter; |
manl2003 | 10:51ee22e230c7 | 35 | int m_DataSize; |
manl2003 | 12:715af3660c73 | 36 | unsigned short m_CRC; |
manl2003 | 10:51ee22e230c7 | 37 | }; |