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

Committer:
aos
Date:
2014-02-13
Revision:
2:5bc47e544b8d
Parent:
1:3b567aa3b09e

File content as of revision 2:5bc47e544b8d:

/* FILE: usb.cpp by Chu Van Thiem
*/
#include "usb.h"

usb::usb(const char * rootdir) : USBHostMSD(rootdir)
{
    // Clear list of files
    filenames.clear();
}

void usb::listdir(const char *dir) {
    DIR *d;
    struct dirent *p;
    
    d = opendir(dir);
    if (d != NULL) {
        filenames.clear();
        while ((p = readdir(d)) != NULL) {
            //printf(" - %s\n", p->d_name);
            filenames.push_back(string(p->d_name));
        }
    } else {
        printf("Could not open directory!\n");
    }
    closedir(d);
}