![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | tfa9xxx_audio_format_t |
tfa9xxx audio format More... | |
struct | tfa9xxx_config_t |
Initialize structure of TFA9XXX. More... | |
struct | tfa9xxx_handle_t |
tfa9xxx codec handler Application should allocate a buffer with TFA9XXX_HANDLE_SIZE for handle definition, such as uint8_t tfa9xxxHandleBuffer[TFA9XXX_HANDLE_SIZE]; tfa9xxx_handle_t *tfa9xxxHandle = tfa9xxxHandleBuffer; More... | |
Macros | |
#define | TFA9XXX_I2C_HANDLER_SIZE (CODEC_I2C_MASTER_HANDLER_SIZE) |
tfa9xxx handle size | |
#define | TFA9XXX_I2C_BAUDRATE (400000U) |
TFA9XXX_ I2C baudrate. | |
Enumerations | |
enum | tfa9xxx_protocol_t { kTFA9XXX_BusI2S = 0 } |
The audio data transfer protocol choice. More... | |
enum | _tfa9xxx_sample_rate { kTFA9XXX_AudioSampleRate48KHz = 48000U } |
audio sample rate definition, more sample rates can be supported in the future More... | |
enum | _tfa9xxx_audio_bit_width { kTFA9XXX_AudioBitWidth16bit = 16U } |
audio bit width, more bit width can be supported in the future More... | |
enum | _tfa98xxx_play_channel { kTFA9XXX_PlayChannelLeft0 = 1U, kTFA9XXX_PlayChannelRight0 = 2U } |
play channel More... | |
Functions | |
status_t | TFA9XXX_Init (tfa9xxx_handle_t *handle, tfa9xxx_config_t *tfa9xxxConfig) |
Initialize the TFA, put the TFA to operating state, allocate memory side. More... | |
status_t | TFA9XXX_Deinit (tfa9xxx_handle_t *handle) |
Deinitialize the TFA, put the TFA to powerdown state. More... | |
status_t | TFA9XXX_SetMute (tfa9xxx_handle_t *handle, bool isMute) |
Mute/Unmute the TFA. More... | |
status_t | TFA9XXX_ConfigDataFormat (tfa9xxx_handle_t *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) |
Configure the TFA based on I2S format. More... | |
status_t | TFA9XXX_SetVolume (tfa9xxx_handle_t *handle, uint32_t volume) |
Set the volume level. More... | |
status_t | TFA9XXX_SetPlayChannel (tfa9xxx_handle_t *handle, uint32_t playChannel) |
Set the audio channel for a speaker. More... | |
status_t | TFA9XXX_Start (tfa9xxx_handle_t *handle) |
Start the TFA. More... | |
status_t | TFA9XXX_Stop (tfa9xxx_handle_t *handle) |
Stop the TFA. More... | |
status_t | TFA9XXX_Reset (tfa9xxx_handle_t *handle) |
Reset the TFA. More... | |
status_t | TFA9XXX_CheckCalibrationStatus (tfa9xxx_handle_t *handle, bool *isTFACalibrated) |
check if TFA is calibrated. More... | |
status_t | TFA9XXX_CalibrateSpeakerBoost (tfa9xxx_handle_t *handle) |
Start Speakerboost Calibration. More... | |
status_t | TFA9XXX_HardcodeCalibrationValue (tfa9xxx_handle_t *handle) |
Hardcode calibration value for DSP usage instead of triggering calibration. More... | |
status_t | TFA9XXX_GetStatus (tfa9xxx_handle_t *handle) |
Get the status of a running TFA. More... | |
status_t | TFA9XXX_ConvertErrorCode (int32_t rc) |
Convert the return check value from TFA driver to predefined error code. More... | |
Driver version | |
#define | FSL_TFA9XXX_DRIVER_VERSION (MAKE_VERSION(8, 1, 2)) |
TFA9XXX driver version 8.1.2. More... | |
struct tfa9xxx_audio_format_t |
Data Fields | |
enum _tfa9xxx_sample_rate | sampleRate |
sample rate | |
enum _tfa9xxx_audio_bit_width | bitWidth |
bit width | |
struct tfa9xxx_config_t |
Data Fields | |
tfa9xxx_protocol_t | protocol |
Audio transfer protocol. | |
tfa9xxx_audio_format_t | format |
Audio format. | |
uint8_t | slaveAddress |
tfa9xxx device address | |
codec_i2c_config_t | i2cConfig |
i2c configuration | |
uint8_t * | tfaContainer |
tfa container array | |
uint8_t | deviceIndex |
tfa device index, starting from 0, up to TFA9XXX_DEV_NUM - 1 | |
struct tfa9xxx_handle_t |
Data Fields | |
tfa9xxx_config_t * | config |
tfa9xxx config pointer | |
uint8_t | i2cHandle [TFA9XXX_I2C_HANDLER_SIZE] |
i2c handle | |
#define FSL_TFA9XXX_DRIVER_VERSION (MAKE_VERSION(8, 1, 2)) |
enum tfa9xxx_protocol_t |
enum _tfa9xxx_sample_rate |
status_t TFA9XXX_Init | ( | tfa9xxx_handle_t * | handle, |
tfa9xxx_config_t * | tfa9xxxConfig | ||
) |
handle | TFA9XXX handle structure. |
tfa9xxxConfig | TFA9XXX configuration structure. |
status_t TFA9XXX_Deinit | ( | tfa9xxx_handle_t * | handle | ) |
handle | TFA9XXX handle structure. |
status_t TFA9XXX_SetMute | ( | tfa9xxx_handle_t * | handle, |
bool | isMute | ||
) |
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | TFA9XXX handle structure. |
isMute | true is mute, false is unmute.. |
status_t TFA9XXX_ConfigDataFormat | ( | tfa9xxx_handle_t * | handle, |
uint32_t | mclk, | ||
uint32_t | sampleRate, | ||
uint32_t | bitWidth | ||
) |
Assuming TFA_Init() is already called by calling CODEC_Init(), the TFA will be in operating state. So before calling TFA_SetFormat(), the TFA needs to be in powerdown state by calling TFA_Stop().
handle | TFA9XXX handle structure. |
mclk | The mclk. |
sampleRate | The sample rate. |
bitWidth | The bit width. |
status_t TFA9XXX_SetVolume | ( | tfa9xxx_handle_t * | handle, |
uint32_t | volume | ||
) |
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | TFA9XXX handle structure. |
volume | volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. |
status_t TFA9XXX_SetPlayChannel | ( | tfa9xxx_handle_t * | handle, |
uint32_t | playChannel | ||
) |
By default, I2S channel is configured by the .tfaContainer
in tfa9xxx_config_t
. So you don't need to call this function. However, if required, calling this function allows overwriting I2S channel selection. This can be useful when the tuning is done, and you simply want to change the I2S channel.
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | TFA9XXX handle structure. |
playChannel | _codec_play_channel play channel, available values are kCODEC_PlayChannelSpeakerLeft, kCODEC_PlayChannelSpeakerRight, kCODEC_PlayChannelSpeakerLeft | kCODEC_PlayChannelSpeakerRight. |
status_t TFA9XXX_Start | ( | tfa9xxx_handle_t * | handle | ) |
Start device will initialize if the device is in cold state if already warm then only clocks will be started.
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | The TFA codec handle. |
status_t TFA9XXX_Stop | ( | tfa9xxx_handle_t * | handle | ) |
Stop will put the TFA in powerdown/standby mode, the next time TFA start will be a warm start.
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | The TFA9XXX handle structure. |
status_t TFA9XXX_Reset | ( | tfa9xxx_handle_t * | handle | ) |
Reset will put the in powerdown/standby mode, the next time TFA start will be a cold start.
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | The TFA9XXX handle structure. |
status_t TFA9XXX_CheckCalibrationStatus | ( | tfa9xxx_handle_t * | handle, |
bool * | isTFACalibrated | ||
) |
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | The TFA9XXX handle structure. |
isTFACalibrated | This value stores if TFA is calibrated. |
status_t TFA9XXX_CalibrateSpeakerBoost | ( | tfa9xxx_handle_t * | handle | ) |
The calibration will measure speaker impedance, and calculate the speaker impedance at 25 degree. This value will be used to estimate the real-time temperature.
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | The TFA codec handle. |
status_t TFA9XXX_HardcodeCalibrationValue | ( | tfa9xxx_handle_t * | handle | ) |
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | TFA9XXX handle structure. |
status_t TFA9XXX_GetStatus | ( | tfa9xxx_handle_t * | handle | ) |
This function has dependency on internal structure, it has to be called after TFA9XXX_CreatePlatform();
handle | The TFA9XXX handle structure. |
status_t TFA9XXX_ConvertErrorCode | ( | int32_t | rc | ) |
rc | Return check value from TFA driver. |