Alexandre Lemay / Mbed 2 deprecated APP4_FunTimes

Dependencies:   mbed mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Receiver.h Source File

Receiver.h

00001 #ifndef RECEIVER_H
00002 #define RECEIVER_H
00003 
00004 #include "mbed.h"
00005 #include "rtos.h"
00006 
00007 #include <vector>
00008 
00009 
00010 #include "defines.h"
00011 namespace BitData
00012 {
00013     enum
00014     {
00015         zero,
00016         one,
00017         timeout
00018     };
00019 };
00020 
00021 class Receiver
00022 {
00023 public:
00024 
00025     Receiver();
00026     void resetTimer(){time.reset();}
00027     char getNext();
00028     
00029     
00030     
00031 private:
00032     void pushData( char bitData );
00033     void edgeFunction(char mode);
00034     void rise();
00035     void fall();
00036 
00037 private:
00038 static const int size = 8 * 90 *3;
00039 
00040     Timer time;
00041     Semaphore dataReady;
00042     char data[size];
00043 
00044 
00045     int lastTime;
00046     bool timedOut;
00047     
00048     int currentData;
00049     int endData;
00050 };
00051 
00052 class ManchesterReceiver
00053 {
00054 public:
00055     void getMessages();
00056     
00057     bool getByte(unsigned char &val);
00058     
00059     bool getMessage( vector<unsigned char> &message, int &crc);
00060     
00061 private:  
00062     Receiver r;
00063     
00064     bool possiblePreamble;
00065 };
00066 
00067 
00068     
00069     
00070 #endif