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.
Dependencies: SoftSerial SDFileSystem mbed wave_player
Client.h@29:c2d95d88ee0b, 2017-05-17 (annotated)
- Committer:
- Desertification
- Date:
- Wed May 17 09:43:38 2017 +0000
- Revision:
- 29:c2d95d88ee0b
- Parent:
- 26:1c8a7d0bb4b7
DONE (for now)
Who changed what in which revision?
User | Revision | Line number | New 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; |
Desertification | 29:c2d95d88ee0b | 24 | DigitalOut dout; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 25 | wave_player player; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 26 | FILE *wave_file; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 27 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 28 | static const int SEND_FILE = 0b00001111; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 29 | static const int SET_VOLUME = 0b00110011; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 30 | static const int ACK = 0b11111111; |
Desertification | 29:c2d95d88ee0b | 31 | static const int PLAY_LAST = 0b10001011; |
Desertification | 29:c2d95d88ee0b | 32 | char buffer[512]; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 33 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 34 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 35 | void set_volume(); |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 36 | void play_file(); |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 37 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 38 | void handle_type(); |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 39 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 40 | void send_file(); |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 41 | }; |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 42 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 43 | |
Thomas Cauwelier |
26:1c8a7d0bb4b7 | 44 | #endif //VISIBLE_LIGHT_COMMUNICATION_CLIENT_H |