Dependents:
DISCO_L4R9I-LCD-demo
« Back to documentation index
CS42L51_Exported_Functions
Functions
uint32_t cs42l51_Init (uint16_t DeviceAddr, uint16_t Device, uint8_t Volume, uint32_t AudioFreq)
Initialize the audio codec and the control interface.
void cs42l51_DeInit (void)
Deinitialize the audio codec.
uint32_t cs42l51_ReadID (uint16_t DeviceAddr)
Get the CS42L51 ID.
uint32_t cs42l51_Play (uint16_t DeviceAddr, uint16_t *pBuffer, uint16_t Size)
Start the audio Codec play feature.
uint32_t cs42l51_Pause (uint16_t DeviceAddr)
Pause playing on the audio codec.
uint32_t cs42l51_Resume (uint16_t DeviceAddr)
Resume playing on the audio codec.
uint32_t cs42l51_Stop (uint16_t DeviceAddr, uint32_t CodecPdwnMode)
Stop audio Codec playing.
uint32_t cs42l51_SetVolume (uint16_t DeviceAddr, uint8_t Volume)
Set higher or lower the codec volume level.
uint32_t cs42l51_SetFrequency (uint16_t DeviceAddr, uint32_t AudioFreq)
Set new frequency.
uint32_t cs42l51_SetMute (uint16_t DeviceAddr, uint32_t Cmd)
Enable or disable the mute feature on the audio codec.
uint32_t cs42l51_SetOutputMode (uint16_t DeviceAddr, uint8_t Output)
Switch dynamically (while audio file is played) the output target (speaker, headphone, etc).
uint32_t cs42l51_Reset (uint16_t DeviceAddr)
Reset CS42L51 registers.
Function Documentation
void cs42l51_DeInit
(
void
)
Deinitialize the audio codec.
Parameters:
Return values:
Definition at line 225 of file cs42l51.c .
uint32_t cs42l51_Init
(
uint16_t
DeviceAddr ,
uint16_t
Device ,
uint8_t
Volume ,
uint32_t
AudioFreq
)
Initialize the audio codec and the control interface.
Parameters:
DeviceAddr,: Device address on communication bus.
Device,: Can be combination values of OUTPUT_DEVICE_HEADPHONE and INPUT_DEVICE_MIC1.
Volume,: Initial output volume level (from 0 (-100dB) to 100 (0dB)).
AudioFreq,: Initial audio frequency (currently not used).
Return values:
0 if correct communication, else wrong communication.
Definition at line 126 of file cs42l51.c .
uint32_t cs42l51_Pause
(
uint16_t
DeviceAddr )
Pause playing on the audio codec.
Parameters:
DeviceAddr,: Device address on communication Bus.
Return values:
0 if correct communication, else wrong communication
Definition at line 315 of file cs42l51.c .
uint32_t cs42l51_Play
(
uint16_t
DeviceAddr ,
uint16_t *
pBuffer ,
uint16_t
Size
)
Start the audio Codec play feature.
Note: For this codec no Play options are required.
Parameters:
DeviceAddr,: Device address on communication Bus.
Return values:
0 if correct communication, else wrong communication
Definition at line 268 of file cs42l51.c .
uint32_t cs42l51_ReadID
(
uint16_t
DeviceAddr )
Get the CS42L51 ID.
Parameters:
DeviceAddr,: Device address on communication Bus.
Return values:
Definition at line 238 of file cs42l51.c .
uint32_t cs42l51_Reset
(
uint16_t
DeviceAddr )
Reset CS42L51 registers.
Parameters:
DeviceAddr,: Device address on communication Bus.
Return values:
0 if correct communication, else wrong communication
Definition at line 446 of file cs42l51.c .
uint32_t cs42l51_Resume
(
uint16_t
DeviceAddr )
Resume playing on the audio codec.
Parameters:
DeviceAddr,: Device address on communication Bus.
Return values:
0 if correct communication, else wrong communication
Definition at line 331 of file cs42l51.c .
uint32_t cs42l51_SetFrequency
(
uint16_t
DeviceAddr ,
uint32_t
AudioFreq
)
Set new frequency.
Parameters:
DeviceAddr,: Device address on communication Bus.
AudioFreq,: Audio frequency used to play the audio stream.
Return values:
0 if correct communication, else wrong communication
Definition at line 394 of file cs42l51.c .
uint32_t cs42l51_SetMute
(
uint16_t
DeviceAddr ,
uint32_t
Cmd
)
Enable or disable the mute feature on the audio codec.
Parameters:
DeviceAddr,: Device address on communication Bus.
Cmd,: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the mute mode.
Return values:
0 if correct communication, else wrong communication
Definition at line 406 of file cs42l51.c .
uint32_t cs42l51_SetOutputMode
(
uint16_t
DeviceAddr ,
uint8_t
Output
)
Switch dynamically (while audio file is played) the output target (speaker, headphone, etc).
Note: This function is currently not used (only headphone output device).
Parameters:
DeviceAddr,: Device address on communication Bus.
Output,: specifies the audio output device target.
Return values:
0 if correct communication, else wrong communication
Definition at line 436 of file cs42l51.c .
uint32_t cs42l51_SetVolume
(
uint16_t
DeviceAddr ,
uint8_t
Volume
)
Set higher or lower the codec volume level.
Parameters:
DeviceAddr,: Device address on communication Bus.
Volume,: output volume level (from 0 (-100dB) to 100 (0dB)).
Return values:
0 if correct communication, else wrong communication
Definition at line 375 of file cs42l51.c .
uint32_t cs42l51_Stop
(
uint16_t
DeviceAddr ,
uint32_t
CodecPdwnMode
)
Stop audio Codec playing.
It powers down the codec.
Parameters:
DeviceAddr,: Device address on communication Bus.
CodecPdwnMode,: selects the power down mode (currently not used).
Return values:
0 if correct communication, else wrong communication
Definition at line 347 of file cs42l51.c .