arduino-audio-driver
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AudioDriverES8388Class Class Reference

Driver API for ES8388 codec chip. More...

#include <AudioDriver.h>

Inheritance diagram for AudioDriverES8388Class:
AudioDriver

Public Member Functions

 AudioDriverES8388Class (uint16_t deviceAddr=ES8388::ES8388_ADDR, int volumeHack=1)
 
virtual bool begin (CodecConfig codecCfg, DriverDeviceInfo &pins)
 Starts the processing.
 
ES8388 & driver ()
 Provides access to the ES8388 driver.
 
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)
 
int getVolumeHack ()
 
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.
 
bool setInputVolume (int volume)
 Defines the input volume (range: 0-100) if supported.
 
bool setMicrophoneGain (es_mic_gain_t gain)
 
bool setMute (bool mute)
 Mutes all output lines.
 
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.
 
bool setVolume (int volume)
 Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
 
void setVolumeHack (int volume_hack)
 

Protected Member Functions

bool configInterface (codec_mode_t mode, I2SDefinition iface)
 
bool controlState (codec_mode_t mode)
 
bool deinit ()
 
virtual i2c_bus_handle_t getI2C ()
 Determine the TwoWire object from the I2C config or use Wire.
 
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
 
ES8388 es8388
 
int i2c_default_address = -1
 
bool line_active [2] = {true, true}
 
DriverDeviceInfo * p_pins = nullptr
 
int volume_hack = 1
 

Detailed Description

Driver API for ES8388 codec chip.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AudioDriverES8388Class()

AudioDriverES8388Class ( uint16_t  deviceAddr = ES8388::ES8388_ADDR,
int  volumeHack = 1 
)
inline

Member Function Documentation

◆ begin()

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

◆ configInterface()

bool configInterface ( codec_mode_t  mode,
I2SDefinition  iface 
)
inlineprotectedvirtual

< Indicates success (no error)

Reimplemented from AudioDriver.

◆ controlState()

bool controlState ( codec_mode_t  mode)
inlineprotectedvirtual

< Indicates success (no error)

Reimplemented from AudioDriver.

◆ deinit()

bool deinit ( )
inlineprotectedvirtual

< Indicates success (no error)

Reimplemented from AudioDriver.

◆ driver()

ES8388 & driver ( )
inline

Provides access to the ES8388 driver.

◆ end()

virtual bool end ( void  )
inlinevirtualinherited

◆ 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.

◆ getVolume()

int getVolume ( )
inlinevirtual

Determines the actual volume (range: 0-100)

Implements AudioDriver.

◆ getVolumeHack()

int getVolumeHack ( )
inline

◆ init()

bool init ( codec_config_t  codec_cfg)
inlineprotectedvirtual

< Indicates success (no error)

Reimplemented from AudioDriver.

◆ isInputVolumeSupported()

bool isInputVolumeSupported ( )
inlinevirtual

Determines if setInputVolume() is supported.

Reimplemented from AudioDriver.

◆ 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)
inlinevirtualinherited

◆ setI2CAddress()

virtual bool setI2CAddress ( uint16_t  adr)
inlinevirtualinherited

Defines the i2c address.

◆ setInputVolume()

bool setInputVolume ( int  volume)
inlinevirtual

Defines the input volume (range: 0-100) if supported.

Reimplemented from AudioDriver.

◆ setMicrophoneGain()

bool setMicrophoneGain ( es_mic_gain_t  gain)
inline

< Indicates success (no error)

◆ setMute() [1/2]

bool setMute ( bool  enable)
inlinevirtual

Mutes all output lines.

< Indicates success (no error)

Implements AudioDriver.

◆ setMute() [2/2]

bool setMute ( bool  mute,
int  line 
)
inlinevirtual

Mute individual lines: only supported for some rare DACs.

< Indicates success (no error)

< Indicates success (no error)

< Indicates success (no error)

< Indicates success (no error)

Reimplemented from 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.

< Indicates success (no error)

Implements AudioDriver.

◆ setVolumeHack()

void setVolumeHack ( int  volume_hack)
inline

Member Data Documentation

◆ codec_cfg

CodecConfig codec_cfg
protectedinherited

◆ es8388

ES8388 es8388
protected

◆ i2c_default_address

int i2c_default_address = -1
protectedinherited

◆ line_active

bool line_active[2] = {true, true}
protected

◆ p_pins

DriverDeviceInfo* p_pins = nullptr
protectedinherited

◆ volume_hack

int volume_hack = 1
protected

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