ST / X_NUCLEO_CCA01M1

Dependencies:   ST_I2S X_NUCLEO_COMMON

Dependents:   HelloWorld_CCA01M1 HelloWorld_CCA01M1_mbedOS HelloWorld_CCA01M1_mbedOS Karaoke_CCA01M1_CCA02M1_mbedOS ... more

Fork of X_NUCLEO_CCA01M1 by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

STA350BW Class Reference

Class representing a STA350BW component. More...

#include <STA350BW.h>

Inherits SoundTerminal.

Public Member Functions

 STA350BW (PinName reset, uint8_t address, DevI2C &i2c, PinName dpin, PinName clk, PinName wsel, PinName fdpin=NC, PinName mck=NC)
 Constructor.
virtual ~STA350BW (void)
 Destructor.
virtual int init (void *init=NULL)
 Initializing the STA350BW component.
virtual int read_id (uint8_t *id=NULL)
 Getting the ID of the component.
virtual int32_t de_init (void)
 De-initializing the STA350BW component.
virtual int32_t play (int16_t *PCM_buffer, uint16_t PCM_buffer_bytes, bool loop=false)
 Playing a buffer of data.
virtual int32_t stop (void)
 Stop playing.
virtual int32_t set_volume (uint8_t channel, uint8_t value)
 Setting volume.
virtual int32_t set_frequency (uint32_t audio_freq)
 Setting frequency.

Protected Member Functions

int32_t STA350BW_Init (void *init)
 Initializes the STA350BW and the control interface.
int32_t STA350BW_ReadID (uint8_t *id)
 Read the device ID.
int32_t STA350BW_DeInit (void)
 Deinitializes the STA350BW and the control interface.
int32_t STA350BW_Play (int16_t *pData, uint16_t Size)
 Start the audio play.
int32_t STA350BW_Stop (void)
 Stop audio stream.
int32_t STA350BW_Pause (void)
 Pause the audio play.
int32_t STA350BW_Resume (void)
 Resume the audio play.
int32_t STA350BW_SetVolume (uint8_t channel, uint8_t value)
 Control the volume features of the STA350BW.
int32_t STA350BW_SetFrequency (uint32_t audio_freq)
 set the sampling frequency for STA350BW.
int32_t STA350BW_PowerOn (void)
 Power on the device.
int32_t STA350BW_PowerOff (void)
 Power off the device.
int32_t STA350BW_Reset (void)
 Reset device.
int32_t STA350BW_SetEq (uint8_t ram_block, uint8_t filter_number, uint32_t *filter_values)
 Set equalization parameters for STA350BW biquad section.
int32_t STA350BW_SetTone (uint8_t tone_gain)
 Set tone value in the STA350BW tone register.
int32_t STA350BW_SetMute (uint8_t channel, uint8_t state)
 Control the mute features of the STA350BW.
int32_t STA350BW_SetDSPOption (uint8_t option, uint8_t state)
 This function can be used to set advanced DSP options in order to use advanced features on the STA350BW device.
int32_t STA350BW_WriteRAMSet (uint8_t RAM_block, uint8_t RAM_address, uint8_t *pIn)
 private function for writing a RAM set.
void i2s_callback (int narg)
 I2S callback.
status_t read (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumBytesToRead)
 Utility function to read data from STA350BW.
status_t write (uint8_t *pBuffer, uint8_t RegisterAddr, uint16_t NumBytesToWrite)
 Utility function to write data to STA350BW.

Detailed Description

Class representing a STA350BW component.

Definition at line 99 of file STA350BW.h.


Constructor & Destructor Documentation

STA350BW ( PinName  reset,
uint8_t  address,
DevI2C &  i2c,
PinName  dpin,
PinName  clk,
PinName  wsel,
PinName  fdpin = NC,
PinName  mck = NC 
)

Constructor.

Parameters:
resetpin name of the RESET pin of the component.
addressI2C address of the component.
i2cI2C device to be used for communication.
dpinpin name of the DPIN pin of the I2S device to be used for audio transmission.
clkpin name of the CLK pin of the I2S device to be used for audio transmission.
wselpin name of the WSEL pin of the I2S device to be used for audio transmission.
fdpinpin name of the FDPIN pin of the I2S device to be used for audio transmission.
mckpin name of the MCK pin of the I2S device to be used for audio transmission.
Note:
Initialization depends on the I2S interface you wish to use: I2S1) address = STA350BW_ADDRESS_1, dpin = PB_15, clk = PB_13, wsel = PB_12, fdpin = NC, mck = PC_6; I2S2) address = STA350BW_ADDRESS_2, dpin = PC_12, clk = PC_10, wsel = PA_4, fdpin = NC, mck = PC_7.

Definition at line 119 of file STA350BW.h.

virtual ~STA350BW ( void   ) [virtual]

Destructor.

Definition at line 145 of file STA350BW.h.


Member Function Documentation

virtual int32_t de_init ( void   ) [virtual]

De-initializing the STA350BW component.

Parameters:
None.
Return values:
0in case of success, an error code otherwise.

Definition at line 201 of file STA350BW.h.

void i2s_callback ( int  narg ) [protected]

I2S callback.

Parameters:
nargNarg flag.
Return values:
None.

Definition at line 344 of file STA350BW.h.

virtual int init ( void *  init = NULL ) [virtual]

Initializing the STA350BW component.

Parameters:
initPointer to device specific initalization structure.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 175 of file STA350BW.h.

virtual int32_t play ( int16_t *  pData,
uint16_t  Size,
bool  loop = false 
) [virtual]

Playing a buffer of data.

Implements SoundTerminal.

Definition at line 213 of file STA350BW.h.

status_t read ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumBytesToRead 
) [protected]

Utility function to read data from STA350BW.

Parameters:
[out]pBufferpointer to the buffer to read data into.
[in]RegisterAddrspecifies the internal address register to read from.
[in]NumBytesToReadnumber of bytes to read.
Return values:
COMPONENT_OKin case of success, COMPONENT_ERROR otherwise.

Definition at line 366 of file STA350BW.h.

virtual int read_id ( uint8_t *  id = NULL ) [virtual]

Getting the ID of the component.

Parameters:
idPointer to an allocated variable to store the ID into.
Return values:
0in case of success, an error code otherwise.

Implements Component.

Definition at line 191 of file STA350BW.h.

virtual int32_t set_frequency ( uint32_t  audio_freq ) [virtual]

Setting frequency.

Implements SoundTerminal.

Definition at line 263 of file STA350BW.h.

virtual int32_t set_volume ( uint8_t  channel,
uint8_t  value 
) [virtual]

Setting volume.

Implements SoundTerminal.

Definition at line 250 of file STA350BW.h.

int32_t STA350BW_DeInit ( void   ) [protected]

Deinitializes the STA350BW and the control interface.

Parameters:
None.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise.

Definition at line 144 of file STA350BW.cpp.

int32_t STA350BW_Init ( void *  init ) [protected]

Initializes the STA350BW and the control interface.

Parameters:
init,:initialization data.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 63 of file STA350BW.cpp.

int32_t STA350BW_Pause ( void   ) [protected]

Pause the audio play.

Parameters:
None.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 179 of file STA350BW.cpp.

int32_t STA350BW_Play ( int16_t *  pData,
uint16_t  Size 
) [protected]

Start the audio play.

Parameters:
*pData,:pointer to audio data.
Size,:size of the data buffer.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 169 of file STA350BW.cpp.

int32_t STA350BW_PowerOff ( void   ) [protected]

Power off the device.

Parameters:
None.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 346 of file STA350BW.cpp.

int32_t STA350BW_PowerOn ( void   ) [protected]

Power on the device.

Parameters:
None.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 326 of file STA350BW.cpp.

int32_t STA350BW_ReadID ( uint8_t *  id ) [protected]

Read the device ID.

Parameters:
id,:identifier.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 158 of file STA350BW.cpp.

int32_t STA350BW_Reset ( void   ) [protected]

Reset device.

Parameters:
NOne.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 376 of file STA350BW.cpp.

int32_t STA350BW_Resume ( void   ) [protected]

Resume the audio play.

Parameters:
None.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 194 of file STA350BW.cpp.

int32_t STA350BW_SetDSPOption ( uint8_t  option,
uint8_t  state 
) [protected]

This function can be used to set advanced DSP options in order to use advanced features on the STA350BW device.

Parameters:
option,:specific option to be setted up This parameter can be a value of STA350BW_DSP_option_selection
state,:state of the option to be controlled. Depending on the selected DSP feature to be controlled, this value can be either ENABLE/DISABLE or a specific numerical parameter related to the specific DSP function. This parameter can be a value of STA350BW state define
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 392 of file STA350BW.cpp.

int32_t STA350BW_SetEq ( uint8_t  ram_block,
uint8_t  filter_number,
uint32_t *  filter_values 
) [protected]

Set equalization parameters for STA350BW biquad section.

Parameters:
ram_block,:ram block to be set
filter_number,:filter number
*filter_values,:pointer to a uint32_t array containing filter coefficients
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 298 of file STA350BW.cpp.

int32_t STA350BW_SetFrequency ( uint32_t  audio_freq ) [protected]

set the sampling frequency for STA350BW.

Parameters:
audio_freq,:audio frequency to be set.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 258 of file STA350BW.cpp.

int32_t STA350BW_SetMute ( uint8_t  channel,
uint8_t  state 
) [protected]

Control the mute features of the STA350BW.

Parameters:
channel,:channel to be muted. This parameter can be a value of STA350BW channel define
state,:enable disable parameter This parameter can be a value of STA350BW state define
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 212 of file STA350BW.cpp.

int32_t STA350BW_SetTone ( uint8_t  tone_gain ) [protected]

Set tone value in the STA350BW tone register.

Parameters:
tone_gain,:gain of the tone control
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 310 of file STA350BW.cpp.

int32_t STA350BW_SetVolume ( uint8_t  channel,
uint8_t  value 
) [protected]

Control the volume features of the STA350BW.

Parameters:
channel,:channel to be controlled. This parameter can be a value of STA350BW channel define
volume,:volume to be set
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 242 of file STA350BW.cpp.

int32_t STA350BW_Stop ( void   ) [protected]

Stop audio stream.

Parameters:
None.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 366 of file STA350BW.cpp.

int32_t STA350BW_WriteRAMSet ( uint8_t  RAM_block,
uint8_t  RAM_address,
uint8_t *  pIn 
) [protected]

private function for writing a RAM set.

Parameters:
RAM_block,:ram block to be written.
RAM_address,:ram address to be written.
*pIn,:pointer to the desired value to be write.
Return values:
COMPONENT_OKif correct setup, COMPONENT_ERROR otherwise

Definition at line 724 of file STA350BW.cpp.

virtual int32_t stop ( void   ) [virtual]

Stop playing.

Implements SoundTerminal.

Definition at line 238 of file STA350BW.h.

status_t write ( uint8_t *  pBuffer,
uint8_t  RegisterAddr,
uint16_t  NumBytesToWrite 
) [protected]

Utility function to write data to STA350BW.

Parameters:
[in]pBufferpointer to the buffer of data to send.
[in]RegisterAddrspecifies the internal address register to write to.
[in]NumBytesToWritenumber of bytes to write.
Return values:
COMPONENT_OKin case of success, COMPONENT_ERROR otherwise.

Definition at line 380 of file STA350BW.h.