arduino-audio-driver
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudioDriver Class Referenceabstract

Abstract Driver API for codec chips. More...

#include <Driver.h>

Inheritance diagram for AudioDriver:
AudioDriverAC101Class AudioDriverAD1938Class AudioDriverCS42448Class AudioDriverCS43l22Class AudioDriverES7210Class AudioDriverES7243Class AudioDriverES7243eClass AudioDriverES8156Class AudioDriverES8311Class AudioDriverES8374Class AudioDriverES8388Class AudioDriverLyratMiniClass AudioDriverPCM3168Class AudioDriverTAS5805MClass AudioDriverWM8960Class AudioDriverWM8978Class AudioDriverWM8994Class NoDriverClass

Public Member Functions

virtual bool begin (CodecConfig codecCfg, DriverPins &pins)
 Starts the processing. More...
 
virtual bool end (void)
 Ends the processing: shut down dac and adc. More...
 
virtual int getVolume ()=0
 Determines the actual volume (range: 0-100) More...
 
virtual bool isInputVolumeSupported ()
 Determines if setInputVolume() is supported. More...
 
virtual bool isVolumeSupported ()
 Determines if setVolume() is suppored. More...
 
 operator bool ()
 
virtual DriverPinspins ()
 Provides the pin information. More...
 
virtual bool setConfig (CodecConfig codecCfg)
 changes the configuration More...
 
virtual bool setInputVolume (int volume)
 Defines the input volume (range: 0-100) if supported. More...
 
virtual bool setMute (bool enable)=0
 Mutes all output lines. More...
 
virtual bool setMute (bool mute, int line)
 Mute individual lines: only supported for some rare DACs. More...
 
bool setPAPower (bool enable)
 Sets the PA Power pin to active or inactive. More...
 
void setPins (DriverPins &pins)
 
virtual bool setVolume (int volume)=0
 Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100. More...
 

Protected Member Functions

virtual bool configInterface (codec_mode_t mode, I2SDefinition iface)
 
virtual bool controlState (codec_mode_t mode)
 
virtual bool deinit ()
 
virtual TwoWire * getI2C ()
 Determine the TwoWire object from the I2C config or use Wire. More...
 
virtual int getI2CAddress ()
 
virtual bool init (codec_config_t codec_cfg)
 
int limitValue (int volume, int min=0, int max=100)
 

Protected Attributes

CodecConfig codec_cfg
 
DriverPinsp_pins = nullptr
 

Detailed Description

Abstract Driver API for codec chips.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

virtual bool begin ( CodecConfig  codecCfg,
DriverPins pins 
)
inlinevirtual

◆ configInterface()

virtual bool configInterface ( codec_mode_t  mode,
I2SDefinition  iface 
)
inlineprotectedvirtual

◆ controlState()

virtual bool controlState ( codec_mode_t  mode)
inlineprotectedvirtual

◆ deinit()

virtual bool deinit ( )
inlineprotectedvirtual

◆ end()

virtual bool end ( void  )
inlinevirtual

◆ getI2C()

virtual TwoWire* getI2C ( )
inlineprotectedvirtual

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

◆ getI2CAddress()

virtual int getI2CAddress ( )
inlineprotectedvirtual

◆ getVolume()

virtual int getVolume ( )
pure virtual

◆ init()

virtual bool init ( codec_config_t  codec_cfg)
inlineprotectedvirtual

◆ isInputVolumeSupported()

virtual bool isInputVolumeSupported ( )
inlinevirtual

◆ 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

◆ operator bool()

operator bool ( )
inline

◆ pins()

virtual DriverPins& pins ( )
inlinevirtual

Provides the pin information.

Reimplemented in AudioDriverCS42448Class, and AudioDriverAD1938Class.

◆ setConfig()

virtual bool setConfig ( CodecConfig  codecCfg)
inlinevirtual

◆ setInputVolume()

virtual bool setInputVolume ( int  volume)
inlinevirtual

◆ setMute() [1/2]

virtual bool setMute ( bool  enable)
pure virtual

◆ setMute() [2/2]

virtual bool setMute ( bool  mute,
int  line 
)
inlinevirtual

Mute individual lines: only supported for some rare DACs.

Reimplemented in AudioDriverWM8978Class, AudioDriverPCM3168Class, AudioDriverES8388Class, AudioDriverAD1938Class, and AudioDriverCS42448Class.

◆ setPAPower()

bool setPAPower ( bool  enable)
inline

Sets the PA Power pin to active or inactive.

◆ setPins()

void setPins ( DriverPins pins)
inline

◆ setVolume()

virtual bool setVolume ( int  volume)
pure virtual

Member Data Documentation

◆ codec_cfg

CodecConfig codec_cfg
protected

◆ p_pins

DriverPins* p_pins = nullptr
protected

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