Talk Watch system using NTP timer for JBB.

Dependencies:   EthernetNetIf FatFileSystem HTTPClient_ToBeRemoved HTTPServer NTPClient_NetServices TextLCD mbed

Fork of StarBoardOrangeTest3 by Yuji Notsu

Committer:
y_notsu
Date:
Sun Jun 22 05:12:34 2014 +0000
Revision:
1:8816ea8be54b
Parent:
0:ae31fe6f181c
Talk Watch using NTP client for JBB

Who changed what in which revision?

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