Go to the documentation of this file.
42 #include "../Common/audio.h"
72 #define OUTPUT_DEVICE_SPEAKER ((uint16_t)0x0001)
73 #define OUTPUT_DEVICE_HEADPHONE ((uint16_t)0x0002)
74 #define OUTPUT_DEVICE_BOTH ((uint16_t)0x0003)
75 #define OUTPUT_DEVICE_AUTO ((uint16_t)0x0004)
76 #define INPUT_DEVICE_DIGITAL_MICROPHONE_1 ((uint16_t)0x0100)
77 #define INPUT_DEVICE_DIGITAL_MICROPHONE_2 ((uint16_t)0x0200)
78 #define INPUT_DEVICE_INPUT_LINE_1 ((uint16_t)0x0300)
79 #define INPUT_DEVICE_INPUT_LINE_2 ((uint16_t)0x0400)
80 #define INPUT_DEVICE_DIGITAL_MIC1_MIC2 ((uint16_t)0x0800)
83 #define DEFAULT_VOLMIN 0x00
84 #define DEFAULT_VOLMAX 0xFF
85 #define DEFAULT_VOLSTEP 0x04
88 #define AUDIO_RESUME 1
91 #define CODEC_PDWN_HW 1
92 #define CODEC_PDWN_SW 2
95 #define AUDIO_MUTE_ON 1
96 #define AUDIO_MUTE_OFF 0
99 #define AUDIO_FREQUENCY_192K ((uint32_t)192000)
100 #define AUDIO_FREQUENCY_96K ((uint32_t)96000)
101 #define AUDIO_FREQUENCY_48K ((uint32_t)48000)
102 #define AUDIO_FREQUENCY_44K ((uint32_t)44100)
103 #define AUDIO_FREQUENCY_32K ((uint32_t)32000)
104 #define AUDIO_FREQUENCY_22K ((uint32_t)22050)
105 #define AUDIO_FREQUENCY_16K ((uint32_t)16000)
106 #define AUDIO_FREQUENCY_11K ((uint32_t)11025)
107 #define AUDIO_FREQUENCY_8K ((uint32_t)8000)
109 #define VOLUME_CONVERT(Volume) (((Volume) > 100)? 100:((uint8_t)(((Volume) * 63) / 100)))
110 #define VOLUME_IN_CONVERT(Volume) (((Volume) >= 100)? 239:((uint8_t)(((Volume) * 240) / 100)))
118 #define WM8994_ID 0x8994
124 #define WM8994_CHIPID_ADDR 0x00
145 uint32_t
wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq);
148 uint32_t
wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
151 uint32_t
wm8994_Stop(uint16_t DeviceAddr, uint32_t Cmd);
uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq)
Initializes the audio codec and the control interface.
AUDIO_DrvTypeDef wm8994_drv
uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
Switch dynamically (while audio file is played) the output target (speaker or headphone).
uint32_t wm8994_Pause(uint16_t DeviceAddr)
Pauses playing on the audio codec.
uint8_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg)
Reads a single data.
uint32_t wm8994_Resume(uint16_t DeviceAddr)
Resumes playing on the audio codec.
void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
Writes a single data.
uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t *pBuffer, uint16_t Size)
Start the audio Codec play feature.
uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t Cmd)
Stops audio Codec playing. It powers down the codec.
uint32_t wm8994_Reset(uint16_t DeviceAddr)
Resets wm8994 registers.
uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
Sets higher or lower the codec volume level.
void wm8994_DeInit(void)
Deinitializes the audio codec.
void AUDIO_IO_Init(void)
Initializes Audio low level.
void AUDIO_IO_DeInit(void)
DeInitializes Audio low level.
uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
Enables or disables the mute feature on the audio codec.
uint32_t wm8994_ReadID(uint16_t DeviceAddr)
Get the WM8994 ID.
void AUDIO_IO_Delay(uint32_t Delay)
AUDIO Codec delay.
uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
Sets new frequency.