16bit resolution PWM wave player with SD card, super lite version.
Dependencies: mbed DirectSPI FastPWM
Supported boards (confirmed):
Nucleo-F030R8
Nucleo-L152RE
Nucleo-F401RE
Nucleo-F411RE
Only compilation is OK (unchecked, but may work):
Nucleo-L073RZ
Nucleo-F334R8
Nucleo-F303RE
Nucleo-F429ZI
Nucleo-F446RE
Nucleo-F446ZE
Nucleo-L476RG
Supported SD card:
SDSC/SDHC card,
FAT16 and FAT32.
(1) At first, format SD card using SD Card Formatter
https://www.sdcard.org/downloads/formatter_4/index.html
(2) Copy PCM wav files to the SD card.
Supported file:
PCM wave file that have file extension ".wav" on root directory.
16bit/8bit, fs(sampling rate)=32kHz,44.1kHz,48kHz.
Stereo/Mono.
Hardware setting:
Refer to the file port_setting.txt
PWM output port:
Left upper(Hi) PWM 8bit out: PB_5 (TM3_CH2)
Right upper(Hi) PWM 8bit out: PB4 (TM3_CH1)
Left lower(Low) PWM 8bit out: PC_9 (TM3_CH4)
Right lower(Low) PWM 8bit out: PC_8 (TM3_CH3)
USER_BUTTON: PC_13(default button)
Next song: One click in Play mode.
Pause : Push long time .
Play : One click from Pause.
sd_card.h@21:dc161a192ba7, 2020-10-09 (annotated)
- Committer:
- mimi3
- Date:
- Fri Oct 09 07:47:36 2020 +0900
- Revision:
- 21:dc161a192ba7
- Parent:
- 0:9a5c2fb0d96f
trivial change
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mimi3 | 0:9a5c2fb0d96f | 1 | #ifndef __SD_CARD_H__ |
mimi3 | 0:9a5c2fb0d96f | 2 | #define __SD_CARD_H__ |
mimi3 | 0:9a5c2fb0d96f | 3 | |
mimi3 | 0:9a5c2fb0d96f | 4 | #include "sys.h" |
mimi3 | 0:9a5c2fb0d96f | 5 | #include "DirectSPI.h" |
mimi3 | 0:9a5c2fb0d96f | 6 | |
mimi3 | 0:9a5c2fb0d96f | 7 | #if HAVE_DIRECT_SPI |
mimi3 | 0:9a5c2fb0d96f | 8 | extern DirectSPI spi; |
mimi3 | 0:9a5c2fb0d96f | 9 | # define spi_read() spi.directWrite8(0xFF) |
mimi3 | 0:9a5c2fb0d96f | 10 | # define spi_read16() spi.directWrite16(0xFFFF) |
mimi3 | 0:9a5c2fb0d96f | 11 | #else |
mimi3 | 0:9a5c2fb0d96f | 12 | extern SPI spi; |
mimi3 | 0:9a5c2fb0d96f | 13 | # define spi_read() spi.write(0xFF) |
mimi3 | 0:9a5c2fb0d96f | 14 | #endif |
mimi3 | 0:9a5c2fb0d96f | 15 | |
mimi3 | 0:9a5c2fb0d96f | 16 | byte sd_data_byte(); |
mimi3 | 0:9a5c2fb0d96f | 17 | void sd_init(); |
mimi3 | 0:9a5c2fb0d96f | 18 | void sd_start_read(dword address); |
mimi3 | 0:9a5c2fb0d96f | 19 | void sd_stop_read(); |
mimi3 | 0:9a5c2fb0d96f | 20 | void sd_read_pulse_byte(word count1); |
mimi3 | 0:9a5c2fb0d96f | 21 | |
mimi3 | 0:9a5c2fb0d96f | 22 | #endif |
mimi3 | 0:9a5c2fb0d96f | 23 |