APP 4

Dependencies:   mbed CRC16 mbed-rtos

MEF.h

Committer:
manl2003
Date:
2016-02-22
Revision:
12:715af3660c73
Parent:
10:51ee22e230c7
Child:
14:9505b98c6623

File content as of revision 12:715af3660c73:

#include "APP.h"

#pragma once

enum STATES
{
    PREAMBLE = 0,
    START = 1,
    TYPE = 2,
    LENGTH = 3,
    DATA = 4,
    CRC16STATE = 5,
    END = 6   
};

class MEF
{
    MEF();
    void ReceiveBit(bool bit);
          
private:

    bool startChecker();
    bool preambleChecker();
    int calculateSize();
    bool compareCRC();
    void error();
    
    
    STATES state;
    bitset<16> m_InputBuffer;
    bitset<MAX_DATA> m_BSPayload;
    char m_CPayload[80];
    int m_Counter;
    int m_DataSize;
    unsigned short m_CRC;
};