Go to the documentation of this file.
64 #define VOLUME_CONVERT(Volume) (((Volume) > 100)? 255:((uint8_t)(((Volume) * 255) / 100)))
67 #if !defined (VERIFY_WRITTENDATA)
116 static uint8_t
CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
133 uint32_t
cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
135 uint32_t counter = 0;
144 switch (OutputDevice)
237 return((uint32_t) Value);
246 uint32_t
cs43l22_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size)
248 uint32_t counter = 0;
274 uint32_t counter = 0;
293 uint32_t counter = 0;
294 volatile uint32_t index = 0x00;
299 for(index = 0x00; index < 0xFF; index++);
321 uint32_t counter = 0;
346 uint32_t counter = 0;
349 if(convertedvol > 0xE6)
385 uint32_t counter = 0;
414 uint32_t counter = 0;
469 #ifdef VERIFY_WRITTENDATA
#define CS43L22_REG_SPEAKER_B_VOL
#define CS43L22_REG_MISC_CTL
#define CS43L22_REG_PLAYBACK_CTL2
#define CS43L22_REG_ANALOG_ZC_SR_SETT
#define CS43L22_REG_LIMIT_CTL1
#define CS43L22_CHIPID_ADDR
Chip ID Register: Chip I.D. and Revision Register Read only register Default value: 0x01 [7:3] CHIPID...
static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
Writes/Read a single data.
#define CS43L22_REG_POWER_CTL1
#define OUTPUT_DEVICE_AUTO
#define CS43L22_REG_MASTER_B_VOL
uint32_t cs43l22_ReadID(uint16_t DeviceAddr)
Get the CS43L22 ID.
static uint8_t Is_cs43l22_Stop
#define VOLUME_CONVERT(Volume)
#define CS43L22_REG_SPEAKER_A_VOL
uint32_t cs43l22_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
Sets higher or lower the codec volume level.
uint32_t cs43l22_Play(uint16_t DeviceAddr, uint16_t *pBuffer, uint16_t Size)
Start the audio Codec play feature.
volatile uint8_t OutputDev
uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg)
Reads a single data.
void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
Writes a single data.
uint32_t cs43l22_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
Enables or disables the mute feature on the audio codec.
#define CS43L22_REG_TONE_CTL
This file contains all the functions prototypes for the cs43l22.c driver.
#define CS43L22_REG_INTERFACE_CTL1
uint32_t cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
Initializes the audio codec and the control interface.
void cs43l22_DeInit(void)
Deinitializes the audio codec.
uint32_t cs43l22_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
Switch dynamically (while audio file is played) the output target (speaker or headphone).
#define OUTPUT_DEVICE_SPEAKER
#define OUTPUT_DEVICE_BOTH
uint32_t cs43l22_Reset(uint16_t DeviceAddr)
Resets cs43l22 registers.
#define CS43L22_REG_PCMA_VOL
#define CS43L22_REG_POWER_CTL2
#define CS43L22_REG_PCMB_VOL
#define CS43L22_REG_CLOCKING_CTL
#define CS43L22_REG_HEADPHONE_B_VOL
uint32_t cs43l22_Resume(uint16_t DeviceAddr)
Resumes playing on the audio codec.
#define CS43L22_REG_HEADPHONE_A_VOL
#define OUTPUT_DEVICE_HEADPHONE
uint32_t cs43l22_Pause(uint16_t DeviceAddr)
Pauses playing on the audio codec.
void AUDIO_IO_Init(void)
Initializes Audio low level.
void AUDIO_IO_DeInit(void)
DeInitializes Audio low level.
#define CS43L22_REG_MASTER_A_VOL
uint32_t cs43l22_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
Sets new frequency.
uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
Stops audio Codec playing. It powers down the codec.
AUDIO_DrvTypeDef cs43l22_drv