#ifndef __MP3_DRIVER_H #define __MP3_DRIVER_H #ifdef __cplusplus extern "C" { #endif #include "stm32f1xx_hal.h" #include /* MP3命令定义 */ #define MP3_HEADER 0x7E // 帧头 #define MP3_VERSION 0xFF // 版本号 #define MP3_LENGTH 0x06 // 数据长度 #define MP3_FOOTER 0xEF // 帧尾 /* MP3功能码 */ #define MP3_CMD_SET_VOLUME 0x06 // 设置音量 #define MP3_CMD_SET_EQ 0x07 // 设置EQ #define MP3_CMD_SET_MODE 0x08 // 设置播放模式 #define MP3_CMD_SET_SOURCE 0x09 // 设置音源 #define MP3_CMD_PLAY 0x0D // 播放 #define MP3_CMD_PAUSE 0x0E // 暂停 #define MP3_CMD_PREV 0x0A // 上一曲 #define MP3_CMD_NEXT 0x0B // 下一曲 #define MP3_CMD_PLAY_INDEX 0x12 // 按索引播放 #define MP3_CMD_STOP 0x16 // 停止 /* MP3音源选择 */ #define MP3_SOURCE_U_DISK 0x01 // U盘 #define MP3_SOURCE_SD_CARD 0x02 // TF卡/SD卡 /* 函数声明 */ HAL_StatusTypeDef MP3_Init(void); HAL_StatusTypeDef MP3_Play(uint16_t index); HAL_StatusTypeDef MP3_Stop(void); HAL_StatusTypeDef MP3_Pause(void); HAL_StatusTypeDef MP3_SetVolume(uint8_t volume); HAL_StatusTypeDef MP3_SetSource(uint8_t source); #ifdef __cplusplus } #endif #endif /* __MP3_DRIVER_H */