first

Dependencies:   mbed mbed-rtos

sender.h

Committer:
ThierryLeonard
Date:
2017-10-25
Revision:
9:8f479f7c1b54
Parent:
7:332766fb3114

File content as of revision 9:8f479f7c1b54:

#ifndef SENDER_H
#define SENDER_H

#include "mbed.h"
#include "rtos.h"
#include <vector>
#include <string>

vector<unsigned char> createFrame(const vector<unsigned char> &message);


class Sender{
    
    enum State {prepare, sendData};

    Serial pc;
    
    DigitalOut MO;
    public:
        void send();
        Sender();
        void sendMessage(const vector<unsigned char> & data);
        Ticker _ticker;
    DigitalOut myled;
        
    private:
        void prepareBit();
        State send_state;
        int _byteSentCount;
        int _bitSentCount;
        vector<unsigned char> data;
        bool _next_bit;
        bool _sending;    
};


#endif