Advanced Operating Systems - Final Project A @ Tokyo Tech ////////////// Author: Chu Van Thiem and Sidik Soleman ////////////// A WAVE file player on the MBED Application Board with an interface to a software on PC via a TCP connection. ////////////// Main functions: 1. Browse files of an attached USB flash 2. The list of the files of the attached USB are displayed on the LCD 3. Use an joystick to select a WAVE file and give an instruction to play that file 4. Adjust the volume using a potentiometer 5. Output audio to the analog audio out jack ////////////// Software (https://github.com/thiemcv/VS/tree/master/Terminal): 1. Connect with the MBED application board via Ethernet connection 2. Read the list of files stored on the USB flash 3. Write files to the USB flash
Dependencies: C12832_lcd EthernetInterface USBHost mbed-rtos mbed wave_player
src/usb.cpp@1:3b567aa3b09e, 2014-02-02 (annotated)
- Committer:
- aos
- Date:
- Sun Feb 02 10:49:19 2014 +0000
- Revision:
- 1:3b567aa3b09e
- Child:
- 2:5bc47e544b8d
Final Project V1: Integrated WAV player + USB file management via ethernet connection
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aos | 1:3b567aa3b09e | 1 | #include "usb.h" |
aos | 1:3b567aa3b09e | 2 | |
aos | 1:3b567aa3b09e | 3 | usb::usb(const char * rootdir) : USBHostMSD(rootdir) |
aos | 1:3b567aa3b09e | 4 | { |
aos | 1:3b567aa3b09e | 5 | // Clear list of files |
aos | 1:3b567aa3b09e | 6 | filenames.clear(); |
aos | 1:3b567aa3b09e | 7 | } |
aos | 1:3b567aa3b09e | 8 | |
aos | 1:3b567aa3b09e | 9 | void usb::listdir(const char *dir) { |
aos | 1:3b567aa3b09e | 10 | DIR *d; |
aos | 1:3b567aa3b09e | 11 | struct dirent *p; |
aos | 1:3b567aa3b09e | 12 | |
aos | 1:3b567aa3b09e | 13 | d = opendir(dir); |
aos | 1:3b567aa3b09e | 14 | if (d != NULL) { |
aos | 1:3b567aa3b09e | 15 | filenames.clear(); |
aos | 1:3b567aa3b09e | 16 | while ((p = readdir(d)) != NULL) { |
aos | 1:3b567aa3b09e | 17 | //printf(" - %s\n", p->d_name); |
aos | 1:3b567aa3b09e | 18 | filenames.push_back(string(p->d_name)); |
aos | 1:3b567aa3b09e | 19 | } |
aos | 1:3b567aa3b09e | 20 | } else { |
aos | 1:3b567aa3b09e | 21 | printf("Could not open directory!\n"); |
aos | 1:3b567aa3b09e | 22 | } |
aos | 1:3b567aa3b09e | 23 | closedir(d); |
aos | 1:3b567aa3b09e | 24 | } |