MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Overview

Data Structures

struct  _pcm186x_audio_format
 PCM186x audio format. More...
 
struct  pcm186x_config
 Initialize structure of PCM186x. More...
 
struct  _pcm186x_handle
 PCM186x codec handler. More...
 

Macros

#define PCM186X_I2C_HANDLER_SIZE   CODEC_I2C_MASTER_HANDLER_SIZE
 PCM186X handle size.
 
#define PCM186X_REG_00   (0)
 Define the register addresses of PCM186X. More...
 
#define PCM186X_RESET   (0xfe)
 PCM186X_PAGE.
 
#define PCM186X_RX_WLEN   (3 << 6)
 Page 0, Register 11.
 
#define PCM186X_GPIO0_FUNC   (7 << 0)
 Page 0, Register 16.
 
#define PCM186X_GPIO2_FUNC   (7 << 0)
 Page 0, Register 17.
 
#define PCM186X_GPIO0_DIR   (7 << 0)
 Page 0, Register 18.
 
#define PCM186X_GPIO2_DIR   (7 << 0)
 Page 0, Register 19.
 
#define PCM186X_SCK_XI_SEL1   (1 << 7)
 Page 0, Register 32.
 
#define PCM186X_PWRDN   (1 << 2)
 Page 0, Register 112.
 
#define PCM186X_I2C_BAUDRATE   (100000U)
 PCM186x I2C baudrate.
 

Typedefs

typedef struct
_pcm186x_audio_format 
pcm186x_audio_format_t
 PCM186x audio format.
 
typedef struct pcm186x_config pcm186x_config_t
 Initialize structure of PCM186x.
 
typedef struct _pcm186x_handle pcm186x_handle_t
 PCM186x codec handler.
 

Enumerations

enum  {
  kPCM186x_AudioBitWidth16bit = 16U,
  kPCM186x_AudioBitWidth20bit = 20U,
  kPCM186x_AudioBitWidth24bit = 24U,
  kPCM186x_AudioBitWidth32bit = 32U
}
 audio bit width More...
 

Functions

status_t PCM186x_Init (pcm186x_handle_t *handle, const pcm186x_config_t *config)
 PCM186x initialise function. More...
 
status_t PCM186x_Deinit (pcm186x_handle_t *handle)
 Deinit the PCM186x codec. More...
 
status_t PCM186x_SetFormat (pcm186x_handle_t *handle, uint32_t sysclk, uint32_t sample_rate, uint32_t bits)
 Configure the data format of audio data. More...
 
status_t PCM186x_WriteReg (pcm186x_handle_t *handle, uint8_t reg, uint8_t val)
 Write register to PCM186x using I2C. More...
 
status_t PCM186x_ReadReg (pcm186x_handle_t *handle, uint8_t reg, uint8_t *val)
 Read register from PCM186x using I2C. More...
 
status_t PCM186x_ModifyReg (pcm186x_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_PCM186X_DRIVER_VERSION   (MAKE_VERSION(2, 0, 1))
 PCM186X driver version 2.0.1.
 

Data Structure Documentation

struct _pcm186x_audio_format

Data Fields

uint32_t mclk_HZ
 master clock frequency
 
uint32_t sampleRate
 sample rate
 
uint32_t bitWidth
 bit width
 
struct pcm186x_config

Data Fields

pcm186x_audio_format_t format
 Audio format.
 
bool master_slave
 Master or slave. More...
 
uint8_t slaveAddress
 PCM186x device address.
 
codec_i2c_config_t i2cConfig
 i2c configuration
 
uint8_t gpio_led
 led gpio number
 

Field Documentation

bool pcm186x_config::master_slave
struct _pcm186x_handle

Data Fields

const pcm186x_config_t * config
 PCM186x config pointer.
 
uint8_t i2cHandle [PCM186X_I2C_HANDLER_SIZE]
 i2c handle
 

Macro Definition Documentation

#define PCM186X_REG_00   (0)

Enumeration Type Documentation

anonymous enum

Enumerator
kPCM186x_AudioBitWidth16bit 

audio bit width 16

kPCM186x_AudioBitWidth20bit 

audio bit width 20

kPCM186x_AudioBitWidth24bit 

audio bit width 24

kPCM186x_AudioBitWidth32bit 

audio bit width 32

Function Documentation

status_t PCM186x_Init ( pcm186x_handle_t *  handle,
const pcm186x_config_t *  config 
)
Parameters
handlePCM186x handle structure.
configPCM186x configuration structure.
status_t PCM186x_Deinit ( pcm186x_handle_t *  handle)

This function close all modules in PCM186x to save power.

Parameters
handlePCM186x handle structure pointer.
status_t PCM186x_SetFormat ( pcm186x_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.

Parameters
handlePCM186x handle structure pointer.
sysclksystem clock of the codec which can be generated by MCLK or PLL output.
sample_rateSample rate of audio file running in PCM186x.
bitsBit depth of audio file.
status_t PCM186x_WriteReg ( pcm186x_handle_t *  handle,
uint8_t  reg,
uint8_t  val 
)
Parameters
handlePCM186x handle structure.
regThe register address in PCM186x.
valValue needs to write into the register.
status_t PCM186x_ReadReg ( pcm186x_handle_t *  handle,
uint8_t  reg,
uint8_t *  val 
)
Parameters
handlePCM186x handle structure.
regThe register address in PCM186x.
valValue written to.
status_t PCM186x_ModifyReg ( pcm186x_handle_t *  handle,
uint8_t  reg,
uint8_t  mask,
uint8_t  val 
)
Parameters
handlePCM186x handle structure.
regThe register address in PCM186x.
maskThe mask code for the bits want to write. The bit you want to write should be 0.
valValue needs to write into the register.