Alexandre Lemay / Mbed 2 deprecated APP4_FunTimes

Dependencies:   mbed mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sender.h Source File

sender.h

00001 #ifndef SENDER_H
00002 #define SENDER_H
00003 
00004 #include "mbed.h"
00005 #include "rtos.h"
00006 #include <vector>
00007 #include <string>
00008 
00009 vector<unsigned char> createFrame(const vector<unsigned char> &message);
00010 
00011 
00012 class Sender{
00013     
00014     enum State {prepare, sendData};
00015 
00016     Serial pc;
00017     
00018     DigitalOut MO;
00019     public:
00020         void send();
00021         Sender();
00022         void sendMessage(const vector<unsigned char> & data);
00023         Ticker _ticker;
00024     DigitalOut myled;
00025         
00026     private:
00027         void prepareBit();
00028         State send_state;
00029         int _byteSentCount;
00030         int _bitSentCount;
00031         vector<unsigned char> data;
00032         bool _next_bit;
00033         bool _sending;    
00034 };
00035 
00036 
00037 #endif