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.
Receiver.h
- Committer:
- ThierryLeonard
- Date:
- 2017-10-25
- Revision:
- 8:7c56fb1ed8c0
- Parent:
- 7:332766fb3114
- Child:
- 9:8f479f7c1b54
File content as of revision 8:7c56fb1ed8c0:
#ifndef RECEIVER_H
#define RECEIVER_H
#include "mbed.h"
#include "rtos.h"
#include <vector>
#include "defines.h"
namespace BitData
{
enum
{
zero,
one,
timeout
};
};
class Receiver
{
public:
Receiver();
void resetTimer(){time.reset();}
char getNext();
private:
void pushData( char bitData );
void edgeFunction(char mode);
void rise();
void fall();
private:
static const int size = 8 * 90 *3;
Timer time;
Semaphore dataReady;
char data[size];
int lastTime;
bool timedOut;
int currentData;
int endData;
};
class ManchesterReceiver
{
public:
void getMessages();
bool getByte(unsigned char &val);
private:
bool getMessage( vector<unsigned char> &message, int &crc);
private:
Receiver r;
bool possiblePreamble;
};
#endif
