Test of Embedded Artists LPCXpresso baseboard ethernet, SD card, audio and OLED display facilities. The program displays the day, date and time on the baseboard OLED and sounds the Big Ben chimes on the hour and quarter hour. On initial startup the program checks that the mbed clock is set and that the chime wav files can be accessed on the SD card. If not it asks to be connected to the internet to obtain the current time and to download the wav files to the SD card.

Dependencies:   EthernetNetIf NTPClient_NetServices mbed EAOLED

Committer:
tom_coxon
Date:
Sat Aug 14 10:33:13 2010 +0000
Revision:
0:f61e8db0570d

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tom_coxon 0:f61e8db0570d 1 /*
tom_coxon 0:f61e8db0570d 2 Library wave file player by Tom Coxon
tom_coxon 0:f61e8db0570d 3
tom_coxon 0:f61e8db0570d 4 Based on WAVEplayer by Vlad Cazan/Stephan Rochon modified by Tom Coxon to:
tom_coxon 0:f61e8db0570d 5
tom_coxon 0:f61e8db0570d 6 1. Run correctly on the Embedded Artists LPCXpresso baseboard.
tom_coxon 0:f61e8db0570d 7 2. To play 8 bit sample size in addition to original 16 bit
tom_coxon 0:f61e8db0570d 8 3. To be more fault tolerant when playing wav files.
tom_coxon 0:f61e8db0570d 9 */
tom_coxon 0:f61e8db0570d 10
tom_coxon 0:f61e8db0570d 11 #ifndef WAVPLAYER_H
tom_coxon 0:f61e8db0570d 12 #define WAVPLAYER_H
tom_coxon 0:f61e8db0570d 13
tom_coxon 0:f61e8db0570d 14 #include "mbed.h"
tom_coxon 0:f61e8db0570d 15
tom_coxon 0:f61e8db0570d 16 #define SAMPLE_FREQ 40000
tom_coxon 0:f61e8db0570d 17 #define BUF_SIZE (SAMPLE_FREQ/10)
tom_coxon 0:f61e8db0570d 18 #define SLICE_BUF_SIZE 1
tom_coxon 0:f61e8db0570d 19
tom_coxon 0:f61e8db0570d 20 typedef struct uFMT_STRUCT {
tom_coxon 0:f61e8db0570d 21 short comp_code;
tom_coxon 0:f61e8db0570d 22 short num_channels;
tom_coxon 0:f61e8db0570d 23 unsigned sample_rate;
tom_coxon 0:f61e8db0570d 24 unsigned avg_Bps;
tom_coxon 0:f61e8db0570d 25 short block_align;
tom_coxon 0:f61e8db0570d 26 short sig_bps;
tom_coxon 0:f61e8db0570d 27 } FMT_STRUCT;
tom_coxon 0:f61e8db0570d 28
tom_coxon 0:f61e8db0570d 29 class WavPlayer {
tom_coxon 0:f61e8db0570d 30
tom_coxon 0:f61e8db0570d 31 public:
tom_coxon 0:f61e8db0570d 32
tom_coxon 0:f61e8db0570d 33 void play_wave(char *wavname);
tom_coxon 0:f61e8db0570d 34
tom_coxon 0:f61e8db0570d 35 private:
tom_coxon 0:f61e8db0570d 36
tom_coxon 0:f61e8db0570d 37 void cleanup(char *);
tom_coxon 0:f61e8db0570d 38 void fill_adc_buf(short *, unsigned);
tom_coxon 0:f61e8db0570d 39 void swapword(unsigned *);
tom_coxon 0:f61e8db0570d 40
tom_coxon 0:f61e8db0570d 41 // a FIFO for the DAC
tom_coxon 0:f61e8db0570d 42 short DAC_fifo[256];
tom_coxon 0:f61e8db0570d 43 short DAC_wptr;
tom_coxon 0:f61e8db0570d 44 short DAC_rptr;
tom_coxon 0:f61e8db0570d 45 short DAC_on;
tom_coxon 0:f61e8db0570d 46
tom_coxon 0:f61e8db0570d 47 void dac_out();
tom_coxon 0:f61e8db0570d 48
tom_coxon 0:f61e8db0570d 49 };
tom_coxon 0:f61e8db0570d 50
tom_coxon 0:f61e8db0570d 51 #endif