Go to the documentation of this file.
27 0x0097, 0x0097, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x000a, 0x01c0, 0x0000, 0x00ff, 0x00ff, 0x0000, 0x0000,
28 0x0000, 0x0000, 0x0000, 0x007b, 0x0100, 0x0032, 0x0000, 0x00c3, 0x00c3, 0x01c0, 0x0000, 0x0000, 0x0000, 0x0000,
29 0x0000, 0x0000, 0x0000, 0x0000, 0x0100, 0x0100, 0x0050, 0x0050, 0x0050, 0x0050, 0x0000, 0x0000, 0x0000, 0x0000,
30 0x0040, 0x0000, 0x0000, 0x0050, 0x0050, 0x0000, 0x0002, 0x0037, 0x004d, 0x0080, 0x0008, 0x0031, 0x0026, 0x00e9,
389 vol = 0x100 | volume;
397 vol = 0x100 | volume;
405 vol = 0x100 | volume;
413 vol = 0x100 | volume;
421 vol = 0x100 | volume;
536 uint32_t divider = 0;
540 divider = sysclk / sample_rate;
545 else if (divider > 256)
547 val = (((divider / 256U) << 6U) | ((divider / 256U) << 3U));
611 cmd = (reg << 1) | ((val >> 8U) & 0x0001U);
633 uint16_t reg_val = 0;
639 reg_val &= (uint16_t)~mask;
#define WM8960_POWER1_ADCL_SHIFT
status_t WM8960_SetVolume(wm8960_handle_t *handle, wm8960_module_t module, uint32_t volume)
Set the volume of different modules in WM8960.
status_t WM8960_SetProtocol(wm8960_handle_t *handle, wm8960_protocol_t protocol)
Set the audio transfer protocol.
#define WM8960_IFACE1_SLAVE
#define WM8960_POWER3_LOMIX_MASK
#define WM8960_POWER2_LOUT1_SHIFT
@ kStatus_InvalidArgument
status_t WM8960_WriteReg(wm8960_handle_t *handle, uint8_t reg, uint16_t val)
Write register to WM8960 using I2C.
status_t WM8960_SetLeftInput(wm8960_handle_t *handle, wm8960_input_t input)
Set left audio input source in WM8960.
const wm8960_config_t * config
status_t WM8960_SetMute(wm8960_handle_t *handle, wm8960_module_t module, bool isEnabled)
Mute modules in WM8960.
uint32_t WM8960_GetVolume(wm8960_handle_t *handle, wm8960_module_t module)
Get the volume of different modules in WM8960.
#define WM8960_POWER2_DACL_MASK
WM8960_POWER2.
enum _wm8960_route wm8960_route_t
WM8960 data route. Only provide some typical data route, not all route listed. Note: Users cannot com...
#define WM8960_POWER2_SPKL_MASK
#define WM8960_IFACE1_FORMAT_MASK
WM8960_IFACE1 FORMAT bits.
status_t CODEC_I2C_Init(void *handle, uint32_t i2cInstance, uint32_t i2cBaudrate, uint32_t i2cSourceClockHz)
Codec i2c bus initilization.
enum _wm8960_input wm8960_input_t
wm8960 input source
status_t WM8960_SetModule(wm8960_handle_t *handle, wm8960_module_t module, bool isEnabled)
Enable/disable expected devices.
#define WM8960_POWER2_SPKR_SHIFT
@ kWM8960_InputDifferentialMicInput3
static const uint16_t wm8960_reg[WM8960_CACHEREGNUM]
#define WM8960_LINVOL
Define the register address of WM8960.
#define WM8960_IFACE1_WL_20BITS
status_t WM8960_SetRightInput(wm8960_handle_t *handle, wm8960_input_t input)
Set right audio input source in WM8960.
status_t WM8960_ReadReg(uint8_t reg, uint16_t *val)
Read register from WM8960 using I2C.
#define WM8960_POWER2_DACR_SHIFT
void WM8960_SetMasterSlave(wm8960_handle_t *handle, bool master)
Set WM8960 as master or slave.
#define WM8960_POWER3_LOMIX_SHIFT
status_t WM8960_ConfigDataFormat(wm8960_handle_t *handle, uint32_t sysclk, uint32_t sample_rate, uint32_t bits)
Configure the data format of audio data.
#define WM8960_POWER1_VREF_MASK
WM8960_POWER1.
#define WM8960_IFACE1_WL(x)
status_t CODEC_I2C_Send(void *handle, uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *txBuff, uint8_t txBuffSize)
codec i2c send function.
#define WM8960_IFACE1_LRP_MASK
WM8960_IFACE1 LRP bit.
#define WM8960_IFACE1_WL_16BITS
#define WM8960_IFACE1_WL_32BITS
@ kWM8960_InputLineINPUT2
#define WM8960_IFACE1_MS_MASK
WM8960_IFACE1 MS bit.
#define WM8960_POWER1_AINR_SHIFT
status_t CODEC_I2C_Deinit(void *handle)
Codec i2c de-initilization.
enum _wm8960_module wm8960_module_t
Modules in WM8960 board.
@ kWM8960_InputSingleEndedMic
@ kWM8960_InputLineINPUT3
#define WM8960_POWER2_ROUT1_SHIFT
#define WM8960_POWER2_SPKL_SHIFT
enum _wm8960_protocol wm8960_protocol_t
The audio data transfer protocol choice. WM8960 only supports I2S format and PCM format.
@ kWM8960_InputDifferentialMicInput2
#define WM8960_POWER3_LMIC_SHIFT
#define WM8960_IFACE1_MS(x)
status_t WM8960_SetPlay(wm8960_handle_t *handle, uint32_t playSource)
SET the WM8960 play source.
#define WM8960_POWER1_AINL_SHIFT
Initialize structure of WM8960.
#define WM8960_POWER2_LOUT1_MASK
#define WM8960_POWER3_RMIC_SHIFT
#define WM8960_POWER1_MICB_SHIFT
#define WM8960_POWER1_AINL_MASK
@ kWM8960_RoutePlaybackandRecord
#define WM8960_POWER3_ROMIX_SHIFT
#define WM8960_POWER1_VREF_SHIFT
status_t WM8960_Init(wm8960_handle_t *handle, const wm8960_config_t *wm8960Config)
WM8960 initialize function.
#define WM8960_CACHEREGNUM
Cache register number.
#define WM8960_POWER3_ROMIX_MASK
uint8_t i2cHandle[WM8960_I2C_HANDLER_SIZE]
#define WM8960_POWER2_DACR_MASK
#define WM8960_IFACE1_MASTER
#define WM8960_POWER1_MICB_MASK
status_t WM8960_ModifyReg(wm8960_handle_t *handle, uint8_t reg, uint16_t mask, uint16_t val)
Modify some bits in the register using I2C.
#define WM8960_POWER2_DACL_SHIFT
#define WM8960_IFACE1_WL_MASK
WM8960_IFACE1 WL bits.
static sai_transceiver_t config
#define WM8960_I2C_BAUDRATE
WM8960 I2C baudrate.
#define WM8960_POWER2_ROUT1_MASK
#define WM8960_POWER1_AINR_MASK
status_t WM8960_SetDataRoute(wm8960_handle_t *handle, wm8960_route_t route)
Set audio data route in WM8960.
int32_t status_t
Type used for all status and error return values.
#define WM8960_POWER1_ADCR_SHIFT
#define WM8960_POWER3_LMIC_MASK
#define WM8960_POWER3_RMIC_MASK
#define WM8960_POWER1_ADCL_MASK
@ kWM8960_PlaySourceInput
#define WM8960_POWER2_SPKR_MASK
status_t WM8960_SetJackDetect(wm8960_handle_t *handle, bool isEnabled)
Enable/disable jack detect feature.
#define WM8960_IFACE1_WL_24BITS
#define WM8960_POWER1_ADCR_MASK
status_t WM8960_Deinit(wm8960_handle_t *handle)
Deinit the WM8960 codec.
static uint16_t reg_cache[WM8960_CACHEREGNUM]