Big Mouth Billy Bass player that takes raw wavefiles and decision list text files from an SD card
Dependencies: SDFileSystem mbed BillyBass
Diff: billybass.hpp
- Revision:
- 5:5b846ef42702
- Child:
- 6:e90a12ca056f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/billybass.hpp Sat Jun 15 03:32:20 2013 +0000 @@ -0,0 +1,39 @@ +#ifndef __included_billybass_hpp +#define __included_billybass_hpp + +#include "mbed.h" +#include "SDFileSystem.h" +#include <list> +#include <cmath> + +struct Song; + +#define SD_NAME "sd" +#define SD_ROOT "/" SD_NAME +#define BASS_DIRECTORY SD_ROOT "/SD_Files" + +typedef int16_t Sample_t; // 16-bit raw, LE samples + +const size_t BUFFER_SIZE = 512; +const float SAMPLE_RATE_HZ = 8000.0; +#define MAX_BASENAME_LENGTH 30 +#define MAX_ACTION_LINE_LENGTH 100 +#define SERIAL_BAUD 115200 + +const unsigned SAMPLE_PERIOD_USEC = (unsigned)(1.0e6/SAMPLE_RATE_HZ); +const size_t SAMPLES_PER_BUFFER = BUFFER_SIZE / sizeof(Sample_t); +const float SECONDS_PER_CHUNK = SAMPLES_PER_BUFFER / SAMPLE_RATE_HZ; + +extern DigitalOut tail; // J3/2 +extern DigitalOut mouth; // J3/1 +extern DigitalOut head; // J3/3 +extern DigitalIn pushbutton; // J3/4 +extern PwmOut redLED; +extern PwmOut greenLED; +extern PwmOut blueLED; +extern AnalogOut speaker; // J10/11 +extern SDFileSystem sd; +extern Serial pc; +extern std::list<Song> songs; + +#endif