arduino-audio-driver
Loading...
Searching...
No Matches
AudioDriver Class Referenceabstract

Abstract Driver API for codec chips. More...

#include <AudioDriver.h>

Inheritance diagram for AudioDriver:
AudioDriverZephyrT< TLV320AIC3104, 0x18 > AudioDriverAC101Class AudioDriverCS42448Class AudioDriverCS42L51Class AudioDriverCS43l22Class AudioDriverCombined AudioDriverES7210Class AudioDriverES7243Class AudioDriverES7243eClass AudioDriverES8156Class AudioDriverES8311Class AudioDriverES8374Class AudioDriverES8388Class AudioDriverLyratMiniClass AudioDriverNAU8325Class AudioDriverPCM3168Class AudioDriverSGTL5000Class AudioDriverTAS5805MClass AudioDriverWM8731Class AudioDriverWM8960Class AudioDriverWM8978Class AudioDriverWM8994Class AudioDriverZephyrT< T, DefaultI2CAddress > NoDriverClass

Public Member Functions

virtual bool begin (CodecConfig codecCfg, DriverDeviceInfo &pins)
 Starts the processing.
virtual bool end (void)
 Ends the processing: shut down dac and adc.
API_GPIO & getGPIO ()
virtual int getI2CAddress ()
 Provides the i2c address.
virtual int getVolume ()=0
 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 enable)=0
 Mutes all output lines.
virtual bool setMute (bool mute, int line)
 Mute individual lines: only supported for some rare DACs.
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.
virtual bool setVolume (int volume)=0
 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)
virtual bool deinit ()
virtual i2c_bus_handle_t getI2C ()
 Determine the TwoWire object from the I2C config or use Wire.
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
int i2c_default_address = -1
DriverDeviceInfo * p_pins = nullptr

Detailed Description

Abstract Driver API for codec chips.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

◆ configInterface()

◆ controlState()

◆ deinit()

◆ end()

virtual bool end ( void )
inlinevirtual

◆ getGPIO()

API_GPIO & getGPIO ( )
inline

◆ getI2C()

virtual i2c_bus_handle_t getI2C ( )
inlineprotectedvirtual

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

◆ getI2CAddress()

virtual int getI2CAddress ( )
inlinevirtual

Provides the i2c address.

◆ getVolume()

◆ init()

◆ isInputVolumeSupported()

◆ isVolumeSupported()

virtual bool isVolumeSupported ( )
inlinevirtual

◆ limitValue()

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

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 )
inlineprotected

◆ operator bool()

operator bool ( )
inline

◆ pins()

virtual DriverDeviceInfo & pins ( )
inlinevirtual

Provides the pin information.

Reimplemented in AudioDriverCS42448Class.

◆ setConfig()

virtual bool setConfig ( CodecConfig codecCfg)
inlinevirtual

◆ setI2CAddress()

virtual bool setI2CAddress ( uint16_t adr)
inlinevirtual

Defines the i2c address.

◆ setInputVolume()

◆ setMute() [1/2]

◆ setMute() [2/2]

virtual bool setMute ( bool mute,
int line )
inlinevirtual

Mute individual lines: only supported for some rare DACs.

Reimplemented in AudioDriverCS42448Class, AudioDriverES8388Class, AudioDriverPCM3168Class, and AudioDriverWM8978Class.

◆ setPAPower()

bool setPAPower ( bool enable)
inline

Sets the PA Power pin to active or inactive.

◆ setPins()

void setPins ( DriverDeviceInfo & pins)
inline

◆ setupI2CAddress()

void setupI2CAddress ( )
inline

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

◆ setVolume()

Member Data Documentation

◆ codec_cfg

CodecConfig codec_cfg
protected

◆ i2c_default_address

int i2c_default_address = -1
protected

◆ p_pins

DriverDeviceInfo* p_pins = nullptr
protected

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