Thomas Cauwelier / Mbed 2 deprecated visible_light_communication

Dependencies:   SoftSerial SDFileSystem mbed wave_player

Committer:
Thomas Cauwelier
Date:
Wed May 17 01:47:04 2017 +0200
Revision:
26:1c8a7d0bb4b7
Child:
29:c2d95d88ee0b
add client logic

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Thomas Cauwelier 26:1c8a7d0bb4b7 1 //
Thomas Cauwelier 26:1c8a7d0bb4b7 2 // Created by thoma on 17-May-17.
Thomas Cauwelier 26:1c8a7d0bb4b7 3 //
Thomas Cauwelier 26:1c8a7d0bb4b7 4
Thomas Cauwelier 26:1c8a7d0bb4b7 5 #ifndef VISIBLE_LIGHT_COMMUNICATION_CLIENT_H
Thomas Cauwelier 26:1c8a7d0bb4b7 6 #define VISIBLE_LIGHT_COMMUNICATION_CLIENT_H
Thomas Cauwelier 26:1c8a7d0bb4b7 7
Thomas Cauwelier 26:1c8a7d0bb4b7 8 #include "mbed.h"
Thomas Cauwelier 26:1c8a7d0bb4b7 9 #include "MySoftSerial.h"
Thomas Cauwelier 26:1c8a7d0bb4b7 10 #include "SDFileSystem.h"
Thomas Cauwelier 26:1c8a7d0bb4b7 11 #include "wave_player.h"
Thomas Cauwelier 26:1c8a7d0bb4b7 12
Thomas Cauwelier 26:1c8a7d0bb4b7 13 class Client {
Thomas Cauwelier 26:1c8a7d0bb4b7 14 public:
Thomas Cauwelier 26:1c8a7d0bb4b7 15 Client(PinName rx_luart, int baudrate_luart);
Thomas Cauwelier 26:1c8a7d0bb4b7 16 void run();
Thomas Cauwelier 26:1c8a7d0bb4b7 17
Thomas Cauwelier 26:1c8a7d0bb4b7 18 private:
Thomas Cauwelier 26:1c8a7d0bb4b7 19
Thomas Cauwelier 26:1c8a7d0bb4b7 20 SPI spi_amp;
Thomas Cauwelier 26:1c8a7d0bb4b7 21 MySoftSerial softSerial;
Thomas Cauwelier 26:1c8a7d0bb4b7 22 SDFileSystem fileSystem;
Thomas Cauwelier 26:1c8a7d0bb4b7 23 AnalogOut aout;
Thomas Cauwelier 26:1c8a7d0bb4b7 24 wave_player player;
Thomas Cauwelier 26:1c8a7d0bb4b7 25 FILE *wave_file;
Thomas Cauwelier 26:1c8a7d0bb4b7 26
Thomas Cauwelier 26:1c8a7d0bb4b7 27 static const int SEND_FILE = 0b00001111;
Thomas Cauwelier 26:1c8a7d0bb4b7 28 static const int SET_VOLUME = 0b00110011;
Thomas Cauwelier 26:1c8a7d0bb4b7 29 static const int ACK = 0b11111111;
Thomas Cauwelier 26:1c8a7d0bb4b7 30 char buffer[64];
Thomas Cauwelier 26:1c8a7d0bb4b7 31
Thomas Cauwelier 26:1c8a7d0bb4b7 32
Thomas Cauwelier 26:1c8a7d0bb4b7 33 void set_volume();
Thomas Cauwelier 26:1c8a7d0bb4b7 34 void play_file();
Thomas Cauwelier 26:1c8a7d0bb4b7 35
Thomas Cauwelier 26:1c8a7d0bb4b7 36 void handle_type();
Thomas Cauwelier 26:1c8a7d0bb4b7 37
Thomas Cauwelier 26:1c8a7d0bb4b7 38 void send_file();
Thomas Cauwelier 26:1c8a7d0bb4b7 39 };
Thomas Cauwelier 26:1c8a7d0bb4b7 40
Thomas Cauwelier 26:1c8a7d0bb4b7 41
Thomas Cauwelier 26:1c8a7d0bb4b7 42 #endif //VISIBLE_LIGHT_COMMUNICATION_CLIENT_H