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.
sys.h
- Committer:
- mimi3
- Date:
- 2019-01-15
- Revision:
- 0:9a5c2fb0d96f
- Child:
- 6:d9ea630e1ba5
File content as of revision 0:9a5c2fb0d96f:
#ifndef __SYS_H__ #define __SYS_H__ #include <stdint.h> #include <stdbool.h> #include "mbed.h" /* Selectable options depended on each situation. * If a functionality is needed, the value should be set to 1. * */ /*---------------------- -- Selectable Options ----------------------*/ #define PWM16BIT 1 #define DATA_8BIT_SUPPORT 1 #define HAVE_BUTTON_SW 1 //; for 'Play','Pause','Power off' /* Enable either the type of blink or dimmer */ #define HAVE_LED_INDICATOR 0 //; blink LED during playing (750msec interval) #define HAVE_LED_INDICATOR_2 1 //; dimmer LED during playing /**********************/ #define HAVE_LED_PAUSE_INDICATOR 1 //; blink or dimmer during pausing #define HAVE_POWER_OFF_MODE 0 //; under construction //-- Select FAT32/FAT16 or FAT16 only #define HAVE_FAT32 1 //; false: FAT16 only, true: FAT16 and FAT32 support //--- end option setting // TEST PORT #define TEST_PORT PA_8 // D7 // LED indicator #define IND_LED PB_10 //-- debug purpose #define UART_INFO 1 #define DEBUG_WAV_PLAYER 0 #define DEBUG_FAT_LIB 0 #define DEBUG_SD_CARD 0 #define TEST_PORT_ENABLE 1 // #define HAVE_DIRECT_SPI 1 typedef uint16_t word; typedef uint32_t dword; typedef uint8_t byte; typedef int8_t sbyte; typedef bool sbit; #endif /* __SYS_H__ */