![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
Data Structures | |
| struct | _pcm512x_audio_format |
| PCM512x audio format. More... | |
| struct | pcm512x_config |
| Initialize structure of PCM512x. More... | |
| struct | _pcm512x_handle |
| PCM512x codec handler. More... | |
Macros | |
| #define | PCM512X_I2C_HANDLER_SIZE CODEC_I2C_MASTER_HANDLER_SIZE |
| PCM512x handle size. | |
| #define | PCM512x_RESET (1) |
| Define the register addresses of PCM512x. More... | |
| #define | PCM512x_RSTR (1 << 0) |
| Page 0, Register 1 - reset. | |
| #define | PCM512x_RQPD (1 << 0) |
| Page 0, Register 2 - power. | |
| #define | PCM512x_RQMR (1 << 0) |
| Page 0, Register 3 - mute. | |
| #define | PCM512x_PLLE (1 << 0) |
| Page 0, Register 4 - PLL. | |
| #define | PCM512x_BCKO (1 << 4) |
| Page 0, Register 9 - BCK, LRCLK configuration. | |
| #define | PCM512x_RLRK (1 << 0) |
| Page 0, Register 12 - Master mode BCK, LRCLK reset. | |
| #define | PCM512x_SDAC (7 << 4) |
| Page 0, Register 14 - DAC reference. | |
| #define | PCM512x_RQSY (1 << 0) |
| Page 0, Register 19 - synchronize. | |
| #define | PCM512x_FSSP (3 << 0) |
| Page 0, Register 34 - fs speed mode. | |
| #define | PCM512x_IPLK (1 << 0) |
| Page 0, Register 37 - Error detection. | |
| #define | PCM512x_ALEN (3 << 0) |
| Page 0, Register 40 - I2S configuration. | |
| #define | PCM512X_I2C_BAUDRATE (100000U) |
| PCM512x I2C baudrate. | |
Typedefs | |
| typedef enum _pcm512x_sysclk_source | pcm512x_sysclk_source_t |
| PCM512x sysclk source. | |
|
typedef struct _pcm512x_audio_format | pcm512x_audio_format_t |
| PCM512x audio format. | |
| typedef struct pcm512x_config | pcm512x_config_t |
| Initialize structure of PCM512x. | |
| typedef struct _pcm512x_handle | pcm512x_handle_t |
| PCM512x codec handler. | |
Enumerations | |
| enum | { kPCM512x_AudioSampleRate8KHz = 8000U, kPCM512x_AudioSampleRate11025Hz = 11025U, kPCM512x_AudioSampleRate12KHz = 12000U, kPCM512x_AudioSampleRate16KHz = 16000U, kPCM512x_AudioSampleRate22050Hz = 22050U, kPCM512x_AudioSampleRate24KHz = 24000U, kPCM512x_AudioSampleRate32KHz = 32000U, kPCM512x_AudioSampleRate44100Hz = 44100U, kPCM512x_AudioSampleRate48KHz = 48000U, kPCM512x_AudioSampleRate88200Hz = 88200U, kPCM512x_AudioSampleRate96KHz = 96000U, kPCM512x_AudioSampleRate176400Hz = 176400U, kPCM512x_AudioSampleRate192KHz = 192000U, kPCM512x_AudioSampleRate384KHz = 384000U } |
| audio sample rate definition More... | |
| enum | { kPCM512x_AudioBitWidth16bit = 16U, kPCM512x_AudioBitWidth20bit = 20U, kPCM512x_AudioBitWidth24bit = 24U, kPCM512x_AudioBitWidth32bit = 32U } |
| audio bit width More... | |
| enum | _pcm512x_sysclk_source { kPCM512x_SysClkSourceMclk = 0U, kPCM512x_SysClkSourceInternalPLL = 1U } |
| PCM512x sysclk source. More... | |
Functions | |
| status_t | PCM512x_Init (pcm512x_handle_t *handle, const pcm512x_config_t *config) |
| PCM512x initialise function. More... | |
| status_t | PCM512x_Deinit (pcm512x_handle_t *handle) |
| Deinit the PCM512x codec. More... | |
| status_t | PCM512x_SetMute (pcm512x_handle_t *handle, bool isEnabled) |
| Mute PCM512x. More... | |
| status_t | PCM512x_SetFormat (pcm512x_handle_t *handle, uint32_t sysclk, uint32_t sample_rate, uint32_t bits) |
| Configure the data format of audio data. More... | |
| status_t | PCM512x_WriteReg (pcm512x_handle_t *handle, uint8_t reg, uint8_t val) |
| Write register to PCM512x using I2C. More... | |
| status_t | PCM512x_ReadReg (pcm512x_handle_t *handle, uint8_t reg, uint8_t *val) |
| Read register from PCM512x using I2C. More... | |
| status_t | PCM512x_ModifyReg (pcm512x_handle_t *handle, uint8_t reg, uint8_t mask, uint8_t val) |
| Modify some bits in the register using I2C. More... | |
Driver version | |
| #define | FSL_PCM512X_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| PCM512X driver version 2.0.1. | |
| struct _pcm512x_audio_format |
Data Fields | |
| uint32_t | mclk_HZ |
| master clock frequency | |
| uint32_t | sampleRate |
| sample rate | |
| uint32_t | bitWidth |
| bit width | |
| struct pcm512x_config |
Data Fields | |
| pcm512x_audio_format_t | format |
| Audio format. | |
| bool | master_slave |
| Master or slave. More... | |
| uint8_t | slaveAddress |
| PCM512x device address. | |
| codec_i2c_config_t | i2cConfig |
| i2c configuration | |
| uint8_t | gpio_led |
| led gpio number | |
| uint8_t | gpio_osc44 |
| oscillator 44.1 gpio number | |
| uint8_t | gpio_osc48 |
| oscillator 48 gpio number | |
| bool pcm512x_config::master_slave |
| struct _pcm512x_handle |
Data Fields | |
| const pcm512x_config_t * | config |
| PCM512x config pointer. | |
| uint8_t | i2cHandle [PCM512X_I2C_HANDLER_SIZE] |
| i2c handle | |
| #define PCM512x_RESET (1) |
| anonymous enum |
| anonymous enum |
| status_t PCM512x_Init | ( | pcm512x_handle_t * | handle, |
| const pcm512x_config_t * | config | ||
| ) |
| handle | PCM512x handle structure. |
| config | PCM512x configuration structure. |
| status_t PCM512x_Deinit | ( | pcm512x_handle_t * | handle | ) |
This function close all modules in PCM512x to save power.
| handle | PCM512x handle structure pointer. |
| status_t PCM512x_SetMute | ( | pcm512x_handle_t * | handle, |
| bool | isEnabled | ||
| ) |
| handle | PCM512x handle structure. |
| isEnabled | Mute or unmute, 1 represent mute. |
| status_t PCM512x_SetFormat | ( | pcm512x_handle_t * | handle, |
| uint32_t | sysclk, | ||
| uint32_t | sample_rate, | ||
| uint32_t | bits | ||
| ) |
This function would configure the registers about the sample rate, bit depths.
| handle | PCM512x handle structure pointer. |
| sysclk | system clock of the codec which can be generated by MCLK or PLL output. |
| sample_rate | Sample rate of audio file running in PCM512x. |
| bits | Bit depth of audio file. |
| status_t PCM512x_WriteReg | ( | pcm512x_handle_t * | handle, |
| uint8_t | reg, | ||
| uint8_t | val | ||
| ) |
| handle | PCM512x handle structure. |
| reg | The register address in PCM512x. |
| val | Value needs to write into the register. |
| status_t PCM512x_ReadReg | ( | pcm512x_handle_t * | handle, |
| uint8_t | reg, | ||
| uint8_t * | val | ||
| ) |
| handle | PCM512x handle structure. |
| reg | The register address in PCM512x. |
| val | Value written to. |
| status_t PCM512x_ModifyReg | ( | pcm512x_handle_t * | handle, |
| uint8_t | reg, | ||
| uint8_t | mask, | ||
| uint8_t | val | ||
| ) |
| handle | PCM512x handle structure. |
| reg | The register address in PCM512x. |
| mask | The mask code for the bits want to write. The bit you want to write should be 0. |
| val | Value needs to write into the register. |