Thomas Cauwelier / Mbed 2 deprecated visible_light_communication

Dependencies:   SoftSerial SDFileSystem mbed wave_player

Relay.h

Committer:
Desertification
Date:
2017-05-17
Revision:
29:c2d95d88ee0b
Parent:
24:d91e9b3b5bd5

File content as of revision 29:c2d95d88ee0b:

//
// Created by thoma on 16-May-17.
//

#ifndef VISIBLE_LIGHT_COMMUNICATION_RELAY_H
#define VISIBLE_LIGHT_COMMUNICATION_RELAY_H


#include "mbed.h"
#include "MySoftSerial.h"

class Relay {
public:
    Relay(PinName tx_luart, int baudrate_luart, PinName tx_usb, PinName rx_usb, int baudrate_usb);
    void run();

private:
    MySoftSerial softSerial;
    Serial usb;

    static const int SEND_FILE = 0b00001111;
    static const int SET_VOLUME = 0b00110011;
    static const int PLAY_LAST = 0b10001011;
    static const int ACK = 0b11111111;
    int buffer[512];

    void handle_type();

    void set_volume();

    void send_file();
    
    void play_last();
};


#endif //VISIBLE_LIGHT_COMMUNICATION_RELAY_H