CircleOS  1
Functions
audio_spe.c File Reference

STw5094a audio codec init and management. More...

Go to the source code of this file.

Functions

void AUDIO_SetMode (AUDIO_DeviceMode_enum mode, AUDIO_Length_enum length, AUDIO_Frequency_enum frequency, AUDIO_Format_enum format)
 
AUDIO_DeviceMode_enum AUDIO_GetMode (void)
 
void AUDIO_Play (const sound_type *buffer, s32 size)
 
void AUDIO_Playback_Stop (void)
 
void AUDIO_Record (sound_type *buffer, s32 size)
 
void AUDIO_Record_Stop (void)
 
AUDIO_Playback_status_enum AUDIO_Playback_GetStatus (void)
 
AUDIO_PlaybackBuffer_Status AUDIO_PlaybackBuffer_GetStatus (AUDIO_PlaybackBuffer_Status value)
 
AUDIO_RecordBuffer_Status AUDIO_RecordBuffer_GetStatus (AUDIO_RecordBuffer_Status value)
 
AUDIO_Recording_status_enum AUDIO_Recording_GetStatus (void)
 
void AUDIO_SPEAKER_OnOff (ON_OFF_enum mode)
 
void AUDIO_MUTE_OnOff (ON_OFF_enum mode)
 
bool AUDIO_IsMute (void)
 
void AUDIO_Inc_Volume (u8 dB)
 
void AUDIO_Dec_Volume (u8 dB)
 
u8 AUDIO_ReadRegister (u8 register_to_read)
 
void AUDIO_WriteRegister (u8 register_to_write, u8 data_to_write)
 
void AUDIO_SetLocalBufferSize (s32 size)
 

Detailed Description

Author
RemiC / YRT / FL
Date
10/2008
09/2009
Version
4.0 Platform = Open4 STM32/STw5094a

Definition in file audio_spe.c.

Function Documentation

void AUDIO_Dec_Volume ( u8  dB)

Decrement the volume of the loudspeaker and headphones.

Parameters
[in]dBnumber of decibels to decrease volume

Definition at line 1627 of file audio_spe.c.

AUDIO_DeviceMode_enum AUDIO_GetMode ( void  )

Get the current codec mode. Mode can be : AUDIO_MODE VOICE_MODE

Returns
The current codec mode.

Definition at line 1296 of file audio_spe.c.

void AUDIO_Inc_Volume ( u8  dB)

Increment the volume of the loudspeaker and headphones.

Parameters
[in]dB: number of decibels to increase volume

Definition at line 1600 of file audio_spe.c.

bool AUDIO_IsMute ( void  )

Indicates if the audio is MUTE or not. If MUT = ON, both buzzer, Loudspeaker and Headphones are cut off.

Returns
: true if AUDIO is Mute

Definition at line 1583 of file audio_spe.c.

void AUDIO_MUTE_OnOff ( ON_OFF_enum  mode)

Set the MUT switch of the audio codec ON or OFF. If MUT = ON, both buzzer, Loudspeaker and Headphones are cut off.

Parameters
[in]mode: ON or OFF

Definition at line 1552 of file audio_spe.c.

void AUDIO_Play ( const sound_type buffer,
s32  size 
)

Issues audio samples (stored in buffer) to the audio codec via I2S.

Parameters
[in]buffer: address of the buffer to play.
[in]size: size of the buffer.

Note : In mono mode, stop is managed by AUDIO_Cpy_Mono(). In stereo mode, it must be managed by the application.

Definition at line 1318 of file audio_spe.c.

AUDIO_Playback_status_enum AUDIO_Playback_GetStatus ( void  )

Gets the status of playback mode.

Returns
status : NO_SOUND, IS_PLAYING

Definition at line 1437 of file audio_spe.c.

void AUDIO_Playback_Stop ( void  )

Stop the playback by stopping the DMA transfer.

Definition at line 1358 of file audio_spe.c.

AUDIO_PlaybackBuffer_Status AUDIO_PlaybackBuffer_GetStatus ( AUDIO_PlaybackBuffer_Status  value)

Gets the status of Playback buffer.

Parameters
[in]value: 0 = get the current status, else reset the flag passed in parameter .
Returns
status : FULL=0, LOW_EMPTY=1, HIGH_EMPTY=2

Definition at line 1458 of file audio_spe.c.

u8 AUDIO_ReadRegister ( u8  register_to_read)

Reads a data byte from one of STw5094A configuration registers.

Parameters
[in]register_to_read: Specify the location where to read (the register number). (0 to 21)
Returns
unsigned byte : The data read

Definition at line 1658 of file audio_spe.c.

void AUDIO_Record ( sound_type buffer,
s32  size 
)

Stores audio samples to the buffer from the audio codec via I2S.

Parameters
[in]buffer: address of the buffer to record into.
[in]size: size of the buffer.

Definition at line 1390 of file audio_spe.c.

void AUDIO_Record_Stop ( void  )

Stop the record by stopping the DMA transfer.

Definition at line 1417 of file audio_spe.c.

AUDIO_RecordBuffer_Status AUDIO_RecordBuffer_GetStatus ( AUDIO_RecordBuffer_Status  value)

Gets the status of Record buffer.

Parameters
[in]value: 0 = get the current status, else reset the flag passed in parameter.
Returns
status : EMPTY=0, LOW_FULL=1, HIGH_FULL=2

Definition at line 1481 of file audio_spe.c.

AUDIO_Recording_status_enum AUDIO_Recording_GetStatus ( void  )

Gets the status of recording mode.

Returns
status : NO_RECORD, IS_RECORDING

Definition at line 1501 of file audio_spe.c.

void AUDIO_SetLocalBufferSize ( s32  size)

Adjust the size of the local buffer used in MONO mode

Parameters
[in]size: size in bytes to assign to local buffer.
Returns
None

Definition at line 1714 of file audio_spe.c.

void AUDIO_SetMode ( AUDIO_DeviceMode_enum  mode,
AUDIO_Length_enum  length,
AUDIO_Frequency_enum  frequency,
AUDIO_Format_enum  format 
)

Set new codec mode. Mode can be : AUDIO_MODE VOICE_MODE

Parameters
[in]mode: the new codec mode.
[in]length: the length of the samples (8, 16 bits...).
[in]frequency: frequency of the samples (8, 16 kHz...).
[in]format: format of the samples (Mono, Stereo).

Definition at line 1267 of file audio_spe.c.

void AUDIO_SPEAKER_OnOff ( ON_OFF_enum  mode)

Set the PLS switch of the audio codec ON or OFF, in order to mute or not the loudspeaker. If PLS = ON, the Loudspeaker is active for audio and buzzer.

Parameters
[in]mode: ON or OFF

Definition at line 1521 of file audio_spe.c.

void AUDIO_WriteRegister ( u8  register_to_write,
u8  data_to_write 
)

Send a data byte to one of STw5094A configuration registers.

Parameters
[in]register_to_write: specifies the location where to write (the register number). (0 to 21)
[in]data_to_write: the data that you want to write.
Returns
None
Warning
The write process pass through an intermediary register table, so the effective write to the audio codec will be delayed.

Definition at line 1689 of file audio_spe.c.