Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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
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:
-
reset pin name of the RESET pin of the component. address I2C address of the component. i2c I2C device to be used for communication. dpin pin name of the DPIN pin of the I2S device to be used for audio transmission. clk pin name of the CLK pin of the I2S device to be used for audio transmission. wsel pin name of the WSEL pin of the I2S device to be used for audio transmission. fdpin pin name of the FDPIN pin of the I2S device to be used for audio transmission. mck pin 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:
-
0 in case of success, an error code otherwise.
Definition at line 201 of file STA350BW.h.
void i2s_callback | ( | int | narg ) | [protected] |
I2S callback.
- Parameters:
-
narg Narg flag.
- Return values:
-
None.
Definition at line 344 of file STA350BW.h.
virtual int init | ( | void * | init = NULL ) |
[virtual] |
Initializing the STA350BW component.
- Parameters:
-
init Pointer to device specific initalization structure.
- Return values:
-
0 in 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] |
status_t read | ( | uint8_t * | pBuffer, |
uint8_t | RegisterAddr, | ||
uint16_t | NumBytesToRead | ||
) | [protected] |
Utility function to read data from STA350BW.
- Parameters:
-
[out] pBuffer pointer to the buffer to read data into. [in] RegisterAddr specifies the internal address register to read from. [in] NumBytesToRead number of bytes to read.
- Return values:
-
COMPONENT_OK in 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:
-
id Pointer to an allocated variable to store the ID into.
- Return values:
-
0 in 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] |
virtual int32_t set_volume | ( | uint8_t | channel, |
uint8_t | value | ||
) | [virtual] |
int32_t STA350BW_DeInit | ( | void | ) | [protected] |
Deinitializes the STA350BW and the control interface.
- Parameters:
-
None.
- Return values:
-
COMPONENT_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if 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_OK if correct setup, COMPONENT_ERROR otherwise
Definition at line 724 of file STA350BW.cpp.
virtual int32_t stop | ( | void | ) | [virtual] |
status_t write | ( | uint8_t * | pBuffer, |
uint8_t | RegisterAddr, | ||
uint16_t | NumBytesToWrite | ||
) | [protected] |
Utility function to write data to STA350BW.
- Parameters:
-
[in] pBuffer pointer to the buffer of data to send. [in] RegisterAddr specifies the internal address register to write to. [in] NumBytesToWrite number of bytes to write.
- Return values:
-
COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
Definition at line 380 of file STA350BW.h.
Generated on Sat Jul 23 2022 08:56:13 by
