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

Driver API for the CS43l22 codec chip on 0x94 (0x4A<<1). More...

#include <AudioDriver.h>

Inheritance diagram for AudioDriverCS43l22Class:
AudioDriver

Public Member Functions

 AudioDriverCS43l22Class (uint16_t deviceAddr=0x4A)
virtual bool begin (CodecConfig codecCfg, DriverDeviceInfo &pins)
 Starts the processing.
CS43L22 & driver ()
 Provides access to the wrapped CS43L22 driver instance.
virtual bool end (void)
 Ends the processing: shut down dac and adc.
API_GPIO & getGPIO ()
virtual int getI2CAddress ()
 Provides the i2c address.
int getVolume ()
 Determines the actual volume (range: 0-100).
virtual bool isInputVolumeSupported ()
 Determines if setInputVolume() is supported.
virtual bool isVolumeSupported ()
 Determines if setVolume() is suppored.
 operator bool ()
virtual DriverDeviceInfo & pins ()
 Provides the pin information.
virtual bool setConfig (CodecConfig codecCfg)
 changes the configuration
virtual bool setI2CAddress (uint16_t adr)
 Defines the i2c address.
virtual bool setInputVolume (int volume)
 Defines the input volume (range: 0-100) if supported.
virtual bool setMute (bool mute, int line)
 Mute individual lines: only supported for some rare DACs.
bool setMute (bool mute)
 Mutes all output lines.
bool setPAPower (bool enable)
 Sets the PA Power pin to active or inactive.
void setPins (DriverDeviceInfo &pins)
void setupI2CAddress ()
 If no address is defined in the pins we provide it here.
bool setVolume (int volume)
 Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.

Protected Member Functions

virtual bool configInterface (codec_mode_t mode, I2SDefinition iface)
virtual bool controlState (codec_mode_t mode)
bool deinit ()
uint32_t getFrequency (samplerate_t rateNum)
virtual i2c_bus_handle_t getI2C ()
 Determine the TwoWire object from the I2C config or use Wire.
uint16_t getOutput (output_device_t output_device)
virtual bool init (codec_config_t codec_cfg)
int limitValue (int volume, int min=0, int max=100)
int mapVolume (int x, int in_min, int in_max, int out_min, int out_max)

Protected Attributes

CodecConfig codec_cfg
CS43L22 cs43l22
int i2c_default_address = -1
DriverDeviceInfo * p_pins = nullptr
int volume = 100

Detailed Description

Driver API for the CS43l22 codec chip on 0x94 (0x4A<<1).

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AudioDriverCS43l22Class()

AudioDriverCS43l22Class ( uint16_t deviceAddr = 0x4A)
inline

Member Function Documentation

◆ begin()

virtual bool begin ( CodecConfig codecCfg,
DriverDeviceInfo & pins )
inlinevirtual

Starts the processing.

Reimplemented from AudioDriver.

◆ configInterface()

◆ controlState()

◆ deinit()

bool deinit ( )
inlineprotectedvirtual

Reimplemented from AudioDriver.

◆ driver()

CS43L22 & driver ( )
inline

Provides access to the wrapped CS43L22 driver instance.

◆ end()

virtual bool end ( void )
inlinevirtualinherited

◆ getFrequency()

uint32_t getFrequency ( samplerate_t rateNum)
inlineprotected

< set to 8k samples per second

< set to 11.025k samples per second

< set to 16k samples in per second

< set to 22.050k samples per second

< set to 24k samples in per second

< set to 32k samples in per second

< set to 44.1k samples per second

< set to 48k samples per second

◆ getGPIO()

API_GPIO & getGPIO ( )
inlineinherited

◆ getI2C()

virtual i2c_bus_handle_t getI2C ( )
inlineprotectedvirtualinherited

Determine the TwoWire object from the I2C config or use Wire.

◆ getI2CAddress()

virtual int getI2CAddress ( )
inlinevirtualinherited

Provides the i2c address.

◆ getOutput()

uint16_t getOutput ( output_device_t output_device)
inlineprotected

◆ getVolume()

int getVolume ( )
inlinevirtual

Determines the actual volume (range: 0-100).

Implements AudioDriver.

◆ init()

◆ isInputVolumeSupported()

◆ isVolumeSupported()

virtual bool isVolumeSupported ( )
inlinevirtualinherited

◆ limitValue()

int limitValue ( int volume,
int min = 0,
int max = 100 )
inlineprotectedinherited

make sure that value is in range

Parameters
volume
Returns

◆ mapVolume()

int mapVolume ( int x,
int in_min,
int in_max,
int out_min,
int out_max )
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlineinherited

◆ pins()

virtual DriverDeviceInfo & pins ( )
inlinevirtualinherited

Provides the pin information.

Reimplemented in AudioDriverCS42448Class.

◆ setConfig()

virtual bool setConfig ( CodecConfig codecCfg)
inlinevirtual

changes the configuration

Reimplemented from AudioDriver.

◆ setI2CAddress()

virtual bool setI2CAddress ( uint16_t adr)
inlinevirtualinherited

Defines the i2c address.

◆ setInputVolume()

◆ setMute() [1/2]

virtual bool setMute ( bool mute,
int line )
inlinevirtualinherited

Mute individual lines: only supported for some rare DACs.

Reimplemented in AudioDriverCS42448Class, AudioDriverES8388Class, AudioDriverPCM3168Class, and AudioDriverWM8978Class.

◆ setMute() [2/2]

bool setMute ( bool enable)
inlinevirtual

Mutes all output lines.

Implements AudioDriver.

◆ setPAPower()

bool setPAPower ( bool enable)
inlineinherited

Sets the PA Power pin to active or inactive.

◆ setPins()

void setPins ( DriverDeviceInfo & pins)
inlineinherited

◆ setupI2CAddress()

void setupI2CAddress ( )
inlineinherited

If no address is defined in the pins we provide it here.

◆ setVolume()

bool setVolume ( int volume)
inlinevirtual

Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.

Implements AudioDriver.

Member Data Documentation

◆ codec_cfg

CodecConfig codec_cfg
protectedinherited

◆ cs43l22

CS43L22 cs43l22
protected

◆ i2c_default_address

int i2c_default_address = -1
protectedinherited

◆ p_pins

DriverDeviceInfo* p_pins = nullptr
protectedinherited

◆ volume

int volume = 100
protected

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