Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SDFileSystem
sd_card_player.h@7:af45a10fdfb6, 2019-04-27 (annotated)
- Committer:
- kchen7
- Date:
- Sat Apr 27 21:47:02 2019 +0000
- Revision:
- 7:af45a10fdfb6
baseline demo version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kchen7 | 7:af45a10fdfb6 | 1 | #include <mbed.h> |
| kchen7 | 7:af45a10fdfb6 | 2 | |
| kchen7 | 7:af45a10fdfb6 | 3 | typedef struct uFMT_STRUCT { |
| kchen7 | 7:af45a10fdfb6 | 4 | short comp_code; |
| kchen7 | 7:af45a10fdfb6 | 5 | short num_channels; |
| kchen7 | 7:af45a10fdfb6 | 6 | unsigned sample_rate; |
| kchen7 | 7:af45a10fdfb6 | 7 | unsigned avg_Bps; |
| kchen7 | 7:af45a10fdfb6 | 8 | short block_align; |
| kchen7 | 7:af45a10fdfb6 | 9 | short sig_bps; |
| kchen7 | 7:af45a10fdfb6 | 10 | } FMT_STRUCT; |
| kchen7 | 7:af45a10fdfb6 | 11 | |
| kchen7 | 7:af45a10fdfb6 | 12 | |
| kchen7 | 7:af45a10fdfb6 | 13 | class sd_card_player { |
| kchen7 | 7:af45a10fdfb6 | 14 | |
| kchen7 | 7:af45a10fdfb6 | 15 | public: |
| kchen7 | 7:af45a10fdfb6 | 16 | |
| kchen7 | 7:af45a10fdfb6 | 17 | sd_card_player(AnalogOut *_dac); |
| kchen7 | 7:af45a10fdfb6 | 18 | |
| kchen7 | 7:af45a10fdfb6 | 19 | /** the player function. |
| kchen7 | 7:af45a10fdfb6 | 20 | * |
| kchen7 | 7:af45a10fdfb6 | 21 | * @param wavefile A pointer to an opened wave file |
| kchen7 | 7:af45a10fdfb6 | 22 | */ |
| kchen7 | 7:af45a10fdfb6 | 23 | void play(FILE *wavefile); |
| kchen7 | 7:af45a10fdfb6 | 24 | |
| kchen7 | 7:af45a10fdfb6 | 25 | private: |
| kchen7 | 7:af45a10fdfb6 | 26 | void dac_out(void); |
| kchen7 | 7:af45a10fdfb6 | 27 | AnalogOut *wave_DAC; |
| kchen7 | 7:af45a10fdfb6 | 28 | Ticker tick; |
| kchen7 | 7:af45a10fdfb6 | 29 | unsigned short DAC_fifo[256]; |
| kchen7 | 7:af45a10fdfb6 | 30 | short DAC_wptr; |
| kchen7 | 7:af45a10fdfb6 | 31 | volatile short DAC_rptr; |
| kchen7 | 7:af45a10fdfb6 | 32 | short DAC_on; |
| kchen7 | 7:af45a10fdfb6 | 33 | }; |
| kchen7 | 7:af45a10fdfb6 | 34 | |
| kchen7 | 7:af45a10fdfb6 | 35 |
