arduino-audio-driver
Loading...
Searching...
No Matches
CS42448 Class Reference

The CS42448 CODEC from Cirrus Logic provides six multi-bit ana- log-to-digital and eight multi-bit digital-to-analog delta-sigma converters. More...

#include <CS42448.h>

Public Types

enum class  Format {
  LeftJustified24Bit = 0 , I2S = 1 , RightJustified24Bits = 2 , RightJustified16Bits = 3 ,
  OneLine1 = 4 , OneLine2 = 5 , TDM = 6
}
enum class  FunctionalMode { MasterSingleSpeed = 0 , MasterDoubleSpeed , MasterQuadSpeed , SlaveAutoDetect }
enum class  InterruptControl { ActiveHigh = 0 , ActiveLow , OpenDrain }
enum class  MasterFrequency { MasterSingleSpeed = 0 , MasterDoubleSpeed = 2 , MasterQuadSpeed = 4 }
enum class  SoftRamp { ImmediateChange = 0 , ZeroCross , SoftRamp , SoftRampOnZeroCross }

Public Member Functions

bool begin (codec_config_t codecCfg, i2c_bus_handle_t handle, int i2cAddress=-1)
bool end ()
 Mute ADC and DAC and then power down.
bool freeze (bool freeze)
 All mute and volume values are activated on unfreeze.
uint8_t getChipID ()
uint8_t getChipRevision ()
bool getInterruptStatus (uint8_t &status)
int8_t getVolumeADC (uint8_t channel)
int getVolumeDAC (uint8_t channel)
bool setADCHighPassFilterFreeze12 (bool freeze)
bool setADCHighPassFilterFreeze3 (bool freeze)
bool setADCInvert (int invert)
bool setADCInvert (uint8_t channel, int invert)
bool setADCSingleEnded (bool on)
bool setADCSingleEnded (int adc, bool on)
bool setAutoMute (bool autoMute)
bool setDACDeEmphasisControl (bool on)
bool setDACInvert (int invert)
bool setDACInvert (uint8_t channel, int invert)
bool setFormat (CS42448::Format fmt)
bool setInterrupControl (InterruptControl value)
bool setMute (bool mute)
bool setMuteADC (bool mute)
bool setMuteDAC (bool mute)
bool setMuteDAC (uint8_t line, bool mute)
bool setPower (bool active)
 Device Power.
bool setPowerADC (bool active)
bool setPowerADC (int adc, bool active)
 Power on individual ADC from 1 to 3.
bool setPowerAll (bool active)
 Power all ADC and DAC and Device.
bool setPowerDAC (bool active)
bool setPowerDAC (int dac, bool active)
 Power on individual DAC from 1 to 4.
bool setPowerDevices (bool active)
 Power only the selected devices.
bool setSampleRate (int rate)
 Single-Speed Mode (SSM) supports input sample rates up to 50 kHz and uses a 128x oversampling ratio. Double-Speed Mode (DSM) supports input sample rates up to 100 kHz and uses an oversampling ratio of 64x. Quad-Speed Mode (QSM) supports input sample rates up to 200 kHz and uses an oversampling ratio of 32x (Note: QSM for the ADC is only supported in the I2S, Left-Justified, Right-Justified interface formats.
bool setSoftRampControl (CS42448::SoftRamp softRamp)
bool setVolumeADC (int8_t volume)
 Set volume in 0.5 dB increments. -128 .. 127 is -64dB .. 24dB; 0 = 0dB.
bool setVolumeADC (uint8_t channel, int8_t volume)
bool setVolumeDAC (uint8_t channel, uint8_t vol)
bool setVolumeDAC (uint8_t vol)

Static Public Attributes

static constexpr uint8_t CS42448_ADC_Channel_Invert = 0x17
static constexpr uint8_t CS42448_ADC_Control_DAC_DeEmphasis = 0x05
static constexpr uint8_t CS42448_ADC_DIF_I2S = (1 << 0)
static constexpr uint8_t CS42448_ADC_DIF_TDM = (3 << 1)
static constexpr uint8_t CS42448_ADC_FM_SLAVE = (3 << 4)
static constexpr uint8_t CS42448_AIN1_Volume_Control = 0x11
static constexpr uint8_t CS42448_AIN2_Volume_Control = 0x12
static constexpr uint8_t CS42448_AIN3_Volume_Control = 0x13
static constexpr uint8_t CS42448_AIN4_Volume_Control = 0x14
static constexpr uint8_t CS42448_AIN5_Volume_Control = 0x15
static constexpr uint8_t CS42448_AIN6_Volume_Control = 0x16
static constexpr uint8_t CS42448_AOUT1_Volume_Control = 0x08
static constexpr uint8_t CS42448_AOUT2_Volume_Control = 0x09
static constexpr uint8_t CS42448_AOUT3_Volume_Control = 0x0A
static constexpr uint8_t CS42448_AOUT4_Volume_Control = 0x0B
static constexpr uint8_t CS42448_AOUT5_Volume_Control = 0x0C
static constexpr uint8_t CS42448_AOUT6_Volume_Control = 0x0D
static constexpr uint8_t CS42448_AOUT7_Volume_Control = 0x0E
static constexpr uint8_t CS42448_AOUT8_Volume_Control = 0x0F
static constexpr uint8_t CS42448_Chip_ID = 0x01
static constexpr uint8_t CS42448_DAC_Channel_Invert = 0x10
static constexpr uint8_t CS42448_DAC_Channel_Mute = 0x07
static constexpr uint8_t CS42448_DAC_DIF_I2S = (1 << 3)
static constexpr uint8_t CS42448_DAC_DIF_TDM = (3 << 4)
static constexpr uint8_t CS42448_DAC_FM_SLAVE = (3 << 6)
static constexpr uint8_t CS42448_Functional_Mode = 0x03
static constexpr uint8_t CS42448_Interface_Formats = 0x04
static constexpr uint8_t CS42448_MUTEC_Pin_Control = 0x1B
static constexpr uint8_t CS42448_PDN = (1 << 0)
static constexpr uint8_t CS42448_PDN_ADC1 = (1 << 5)
static constexpr uint8_t CS42448_PDN_ADC2 = (1 << 6)
static constexpr uint8_t CS42448_PDN_ADC3 = (1 << 7)
static constexpr uint8_t CS42448_PDN_DAC1 = (1 << 1)
static constexpr uint8_t CS42448_PDN_DAC2 = (1 << 2)
static constexpr uint8_t CS42448_PDN_DAC3 = (1 << 3)
static constexpr uint8_t CS42448_PDN_DAC4 = (1 << 4)
static constexpr uint8_t CS42448_Power_Control = 0x02
static constexpr uint8_t CS42448_Status = 0x19
static constexpr uint8_t CS42448_Status_Control = 0x18
static constexpr uint8_t CS42448_Status_Mask = 0x1A
static constexpr uint8_t CS42448_Transition_Control = 0x06

Protected Member Functions

bool readReg (uint8_t reg, uint8_t *outdata, int datalen=1)
uint8_t setBit (uint8_t number, uint8_t n, bool x)
bool setFormat ()
 Set I2S format based on codec_config.
bool writeReg (uint8_t reg, uint8_t *value, int len)
bool writeReg (uint8_t reg, uint8_t value)

Protected Attributes

codec_config_t codec_config
i2c_bus_handle_t i2c
int i2c_address = 0x48
bool is_active = false

Detailed Description

The CS42448 CODEC from Cirrus Logic provides six multi-bit ana- log-to-digital and eight multi-bit digital-to-analog delta-sigma converters.

Member Enumeration Documentation

◆ Format

enum class Format
strong
Enumerator
LeftJustified24Bit 
I2S 
RightJustified24Bits 
RightJustified16Bits 
OneLine1 
OneLine2 
TDM 

◆ FunctionalMode

enum class FunctionalMode
strong
Enumerator
MasterSingleSpeed 
MasterDoubleSpeed 
MasterQuadSpeed 
SlaveAutoDetect 

◆ InterruptControl

enum class InterruptControl
strong
Enumerator
ActiveHigh 
ActiveLow 
OpenDrain 

◆ MasterFrequency

enum class MasterFrequency
strong
Enumerator
MasterSingleSpeed 
MasterDoubleSpeed 
MasterQuadSpeed 

◆ SoftRamp

enum class SoftRamp
strong
Enumerator
ImmediateChange 
ZeroCross 
SoftRamp 
SoftRampOnZeroCross 

Member Function Documentation

◆ begin()

bool begin ( codec_config_t codecCfg,
i2c_bus_handle_t handle,
int i2cAddress = -1 )
inline

◆ end()

bool end ( )
inline

Mute ADC and DAC and then power down.

◆ freeze()

bool freeze ( bool freeze)
inline

All mute and volume values are activated on unfreeze.

◆ getChipID()

uint8_t getChipID ( )
inline

◆ getChipRevision()

uint8_t getChipRevision ( )
inline

◆ getInterruptStatus()

bool getInterruptStatus ( uint8_t & status)
inline

◆ getVolumeADC()

int8_t getVolumeADC ( uint8_t channel)
inline

◆ getVolumeDAC()

int getVolumeDAC ( uint8_t channel)
inline

◆ readReg()

bool readReg ( uint8_t reg,
uint8_t * outdata,
int datalen = 1 )
inlineprotected

◆ setADCHighPassFilterFreeze12()

bool setADCHighPassFilterFreeze12 ( bool freeze)
inline

◆ setADCHighPassFilterFreeze3()

bool setADCHighPassFilterFreeze3 ( bool freeze)
inline

◆ setADCInvert() [1/2]

bool setADCInvert ( int invert)
inline

◆ setADCInvert() [2/2]

bool setADCInvert ( uint8_t channel,
int invert )
inline

◆ setADCSingleEnded() [1/2]

bool setADCSingleEnded ( bool on)
inline

◆ setADCSingleEnded() [2/2]

bool setADCSingleEnded ( int adc,
bool on )
inline

◆ setAutoMute()

bool setAutoMute ( bool autoMute)
inline

◆ setBit()

uint8_t setBit ( uint8_t number,
uint8_t n,
bool x )
inlineprotected

◆ setDACDeEmphasisControl()

bool setDACDeEmphasisControl ( bool on)
inline

◆ setDACInvert() [1/2]

bool setDACInvert ( int invert)
inline

◆ setDACInvert() [2/2]

bool setDACInvert ( uint8_t channel,
int invert )
inline

◆ setFormat() [1/2]

bool setFormat ( )
inlineprotected

Set I2S format based on codec_config.

◆ setFormat() [2/2]

bool setFormat ( CS42448::Format fmt)
inline

◆ setInterrupControl()

bool setInterrupControl ( InterruptControl value)
inline

◆ setMute()

bool setMute ( bool mute)
inline

◆ setMuteADC()

bool setMuteADC ( bool mute)
inline

◆ setMuteDAC() [1/2]

bool setMuteDAC ( bool mute)
inline

◆ setMuteDAC() [2/2]

bool setMuteDAC ( uint8_t line,
bool mute )
inline

◆ setPower()

bool setPower ( bool active)
inline

Device Power.

◆ setPowerADC() [1/2]

bool setPowerADC ( bool active)
inline

◆ setPowerADC() [2/2]

bool setPowerADC ( int adc,
bool active )
inline

Power on individual ADC from 1 to 3.

◆ setPowerAll()

bool setPowerAll ( bool active)
inline

Power all ADC and DAC and Device.

◆ setPowerDAC() [1/2]

bool setPowerDAC ( bool active)
inline

◆ setPowerDAC() [2/2]

bool setPowerDAC ( int dac,
bool active )
inline

Power on individual DAC from 1 to 4.

◆ setPowerDevices()

bool setPowerDevices ( bool active)
inline

Power only the selected devices.

◆ setSampleRate()

bool setSampleRate ( int rate)
inline

Single-Speed Mode (SSM) supports input sample rates up to 50 kHz and uses a 128x oversampling ratio. Double-Speed Mode (DSM) supports input sample rates up to 100 kHz and uses an oversampling ratio of 64x. Quad-Speed Mode (QSM) supports input sample rates up to 200 kHz and uses an oversampling ratio of 32x (Note: QSM for the ADC is only supported in the I2S, Left-Justified, Right-Justified interface formats.

◆ setSoftRampControl()

bool setSoftRampControl ( CS42448::SoftRamp softRamp)
inline

◆ setVolumeADC() [1/2]

bool setVolumeADC ( int8_t volume)
inline

Set volume in 0.5 dB increments. -128 .. 127 is -64dB .. 24dB; 0 = 0dB.

◆ setVolumeADC() [2/2]

bool setVolumeADC ( uint8_t channel,
int8_t volume )
inline

◆ setVolumeDAC() [1/2]

bool setVolumeDAC ( uint8_t channel,
uint8_t vol )
inline

Sets signal levels in 0.5 dB increment from 0 dB to -127.5 dB; Value range is from 0 to 256; e.g 0 = 0 DB; 180 = -90 DB

◆ setVolumeDAC() [2/2]

bool setVolumeDAC ( uint8_t vol)
inline

◆ writeReg() [1/2]

bool writeReg ( uint8_t reg,
uint8_t * value,
int len )
inlineprotected

◆ writeReg() [2/2]

bool writeReg ( uint8_t reg,
uint8_t value )
inlineprotected

Member Data Documentation

◆ codec_config

codec_config_t codec_config
protected

◆ CS42448_ADC_Channel_Invert

uint8_t CS42448_ADC_Channel_Invert = 0x17
staticconstexpr

◆ CS42448_ADC_Control_DAC_DeEmphasis

uint8_t CS42448_ADC_Control_DAC_DeEmphasis = 0x05
staticconstexpr

◆ CS42448_ADC_DIF_I2S

uint8_t CS42448_ADC_DIF_I2S = (1 << 0)
staticconstexpr

◆ CS42448_ADC_DIF_TDM

uint8_t CS42448_ADC_DIF_TDM = (3 << 1)
staticconstexpr

◆ CS42448_ADC_FM_SLAVE

uint8_t CS42448_ADC_FM_SLAVE = (3 << 4)
staticconstexpr

◆ CS42448_AIN1_Volume_Control

uint8_t CS42448_AIN1_Volume_Control = 0x11
staticconstexpr

◆ CS42448_AIN2_Volume_Control

uint8_t CS42448_AIN2_Volume_Control = 0x12
staticconstexpr

◆ CS42448_AIN3_Volume_Control

uint8_t CS42448_AIN3_Volume_Control = 0x13
staticconstexpr

◆ CS42448_AIN4_Volume_Control

uint8_t CS42448_AIN4_Volume_Control = 0x14
staticconstexpr

◆ CS42448_AIN5_Volume_Control

uint8_t CS42448_AIN5_Volume_Control = 0x15
staticconstexpr

◆ CS42448_AIN6_Volume_Control

uint8_t CS42448_AIN6_Volume_Control = 0x16
staticconstexpr

◆ CS42448_AOUT1_Volume_Control

uint8_t CS42448_AOUT1_Volume_Control = 0x08
staticconstexpr

◆ CS42448_AOUT2_Volume_Control

uint8_t CS42448_AOUT2_Volume_Control = 0x09
staticconstexpr

◆ CS42448_AOUT3_Volume_Control

uint8_t CS42448_AOUT3_Volume_Control = 0x0A
staticconstexpr

◆ CS42448_AOUT4_Volume_Control

uint8_t CS42448_AOUT4_Volume_Control = 0x0B
staticconstexpr

◆ CS42448_AOUT5_Volume_Control

uint8_t CS42448_AOUT5_Volume_Control = 0x0C
staticconstexpr

◆ CS42448_AOUT6_Volume_Control

uint8_t CS42448_AOUT6_Volume_Control = 0x0D
staticconstexpr

◆ CS42448_AOUT7_Volume_Control

uint8_t CS42448_AOUT7_Volume_Control = 0x0E
staticconstexpr

◆ CS42448_AOUT8_Volume_Control

uint8_t CS42448_AOUT8_Volume_Control = 0x0F
staticconstexpr

◆ CS42448_Chip_ID

uint8_t CS42448_Chip_ID = 0x01
staticconstexpr

◆ CS42448_DAC_Channel_Invert

uint8_t CS42448_DAC_Channel_Invert = 0x10
staticconstexpr

◆ CS42448_DAC_Channel_Mute

uint8_t CS42448_DAC_Channel_Mute = 0x07
staticconstexpr

◆ CS42448_DAC_DIF_I2S

uint8_t CS42448_DAC_DIF_I2S = (1 << 3)
staticconstexpr

◆ CS42448_DAC_DIF_TDM

uint8_t CS42448_DAC_DIF_TDM = (3 << 4)
staticconstexpr

◆ CS42448_DAC_FM_SLAVE

uint8_t CS42448_DAC_FM_SLAVE = (3 << 6)
staticconstexpr

◆ CS42448_Functional_Mode

uint8_t CS42448_Functional_Mode = 0x03
staticconstexpr

◆ CS42448_Interface_Formats

uint8_t CS42448_Interface_Formats = 0x04
staticconstexpr

◆ CS42448_MUTEC_Pin_Control

uint8_t CS42448_MUTEC_Pin_Control = 0x1B
staticconstexpr

◆ CS42448_PDN

uint8_t CS42448_PDN = (1 << 0)
staticconstexpr

◆ CS42448_PDN_ADC1

uint8_t CS42448_PDN_ADC1 = (1 << 5)
staticconstexpr

◆ CS42448_PDN_ADC2

uint8_t CS42448_PDN_ADC2 = (1 << 6)
staticconstexpr

◆ CS42448_PDN_ADC3

uint8_t CS42448_PDN_ADC3 = (1 << 7)
staticconstexpr

◆ CS42448_PDN_DAC1

uint8_t CS42448_PDN_DAC1 = (1 << 1)
staticconstexpr

◆ CS42448_PDN_DAC2

uint8_t CS42448_PDN_DAC2 = (1 << 2)
staticconstexpr

◆ CS42448_PDN_DAC3

uint8_t CS42448_PDN_DAC3 = (1 << 3)
staticconstexpr

◆ CS42448_PDN_DAC4

uint8_t CS42448_PDN_DAC4 = (1 << 4)
staticconstexpr

◆ CS42448_Power_Control

uint8_t CS42448_Power_Control = 0x02
staticconstexpr

◆ CS42448_Status

uint8_t CS42448_Status = 0x19
staticconstexpr

◆ CS42448_Status_Control

uint8_t CS42448_Status_Control = 0x18
staticconstexpr

◆ CS42448_Status_Mask

uint8_t CS42448_Status_Mask = 0x1A
staticconstexpr

◆ CS42448_Transition_Control

uint8_t CS42448_Transition_Control = 0x06
staticconstexpr

◆ i2c

i2c_bus_handle_t i2c
protected

◆ i2c_address

int i2c_address = 0x48
protected

◆ is_active

bool is_active = false
protected

The documentation for this class was generated from the following file: