1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ... */
#ifndef __AUDIO_IF_H
#define __AUDIO_IF_H
#include "main.h"
Includes
#define AUDIO_BUFFER_SIZE 1000
#define AUDIO_DEFAULT_VOLUME 70
/* ... */
#define AUDIO_FILE_SIZE 147500
#define AUDIO_FILE_ADDRESS 0x08080000
Exported constants
typedef enum {
AUDIO_STATE_IDLE = 0,
AUDIO_STATE_INIT,
AUDIO_STATE_PLAYING,
...}AUDIO_PLAYBACK_StateTypeDef;
typedef enum {
AUDIO_ERROR_NONE = 0,
AUDIO_ERROR_NOTREADY,
AUDIO_ERROR_IO,
AUDIO_ERROR_EOF,
...}AUDIO_ErrorTypeDef;
typedef enum {
BUFFER_OFFSET_NONE = 0,
BUFFER_OFFSET_HALF,
BUFFER_OFFSET_FULL,
...}BUFFER_StateTypeDef;
typedef struct {
uint8_t buff[AUDIO_BUFFER_SIZE];
uint32_t fptr;
BUFFER_StateTypeDef state;
...}AUDIO_BufferTypeDef;
Exported types
AUDIO_ErrorTypeDef AUDIO_Init(void);
AUDIO_ErrorTypeDef AUDIO_Start(void);
AUDIO_ErrorTypeDef AUDIO_Process(void);
AUDIO_ErrorTypeDef AUDIO_Stop(void);Exported functions
/* ... */#endif