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

Driver API for WM8990 codec chip. More...

#include <AudioDriver.h>

Inheritance diagram for AudioDriverWM8960Class:
AudioDriver

Public Member Functions

 AudioDriverWM8960Class (uint16_t deviceAddr=WM8960_I2C_ADDRESS)
bool begin (CodecConfig codecCfg, DriverDeviceInfo &pins)
 Starts the processing.
WM8960 & driver ()
 Provides access to the WM8960 driver.
void dumpRegisters ()
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).
bool isInputVolumeSupported ()
 Determines if setInputVolume() is supported.
bool isVolumeSupported ()
 Determines if setVolume() is suppored.
 operator bool ()
virtual DriverDeviceInfo & pins ()
 Provides the pin information.
virtual bool setConfig (CodecConfig codecCfg)
 changes the configuration
void setEnablePLL (bool active)
 Configuration: enable/disable PLL (active by default).
virtual bool setI2CAddress (uint16_t adr)
 Defines the i2c address.
void setI2CRetryCount (int cnt)
 Configuration: define retry count (default : 0).
bool setInputVolume (int volume)
 Defines the input volume (range: 0-100) if supported.
void setMclkHz (uint32_t hz)
 Configuration: define master clock frequency (default: 0).
virtual bool setMute (bool mute, int line)
 Mute individual lines: only supported for some rare DACs.
bool setMute (bool enable)
 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)
bool configure_clocking ()
virtual bool controlState (codec_mode_t mode)
virtual bool deinit ()
int getFeatures (CodecConfig cfg)
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)
wm8960_mode_t modeMasterSlave (bool is_master)
 if microcontroller is master then module is slave
wm8960_adc_dac_sample_rate_t sampleRate (int rate)
wm8960_word_length_t wordLength (int bits)

Protected Attributes

CodecConfig codec_cfg
int i2c_default_address = -1
int i2c_retry_count = 0
DriverDeviceInfo * p_pins = nullptr
int volume_in = 100
int volume_out = 100
bool vs1053_enable_pll = true
uint32_t vs1053_mclk_hz = 0
WM8960 wm8960

Detailed Description

Driver API for WM8990 codec chip.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AudioDriverWM8960Class()

AudioDriverWM8960Class ( uint16_t deviceAddr = WM8960_I2C_ADDRESS)
inline

Member Function Documentation

◆ begin()

bool begin ( CodecConfig codecCfg,
DriverDeviceInfo & pins )
inlinevirtual

Starts the processing.

Reimplemented from AudioDriver.

◆ configInterface()

◆ configure_clocking()

bool configure_clocking ( )
inlineprotected

◆ controlState()

◆ deinit()

◆ driver()

WM8960 & driver ( )
inline

Provides access to the WM8960 driver.

◆ dumpRegisters()

void dumpRegisters ( )
inline

◆ end()

bool end ( void )
inlinevirtual

Ends the processing: shut down dac and adc.

Reimplemented from AudioDriver.

◆ getFeatures()

int getFeatures ( CodecConfig cfg)
inlineprotected

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

◆ init()

◆ isInputVolumeSupported()

bool isInputVolumeSupported ( )
inlinevirtual

Determines if setInputVolume() is supported.

Reimplemented from AudioDriver.

◆ isVolumeSupported()

bool isVolumeSupported ( )
inlinevirtual

Determines if setVolume() is suppored.

Reimplemented from AudioDriver.

◆ 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

◆ modeMasterSlave()

wm8960_mode_t modeMasterSlave ( bool is_master)
inlineprotected

if microcontroller is master then module is slave

◆ operator bool()

operator bool ( )
inlineinherited

◆ pins()

virtual DriverDeviceInfo & pins ( )
inlinevirtualinherited

Provides the pin information.

Reimplemented in AudioDriverCS42448Class.

◆ sampleRate()

wm8960_adc_dac_sample_rate_t sampleRate ( int rate)
inlineprotected

◆ setConfig()

virtual bool setConfig ( CodecConfig codecCfg)
inlinevirtual

changes the configuration

Reimplemented from AudioDriver.

◆ setEnablePLL()

void setEnablePLL ( bool active)
inline

Configuration: enable/disable PLL (active by default).

◆ setI2CAddress()

virtual bool setI2CAddress ( uint16_t adr)
inlinevirtualinherited

Defines the i2c address.

◆ setI2CRetryCount()

void setI2CRetryCount ( int cnt)
inline

Configuration: define retry count (default : 0).

◆ setInputVolume()

bool setInputVolume ( int volume)
inlinevirtual

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

Reimplemented from AudioDriver.

◆ setMclkHz()

void setMclkHz ( uint32_t hz)
inline

Configuration: define master clock frequency (default: 0).

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

◆ wordLength()

wm8960_word_length_t wordLength ( int bits)
inlineprotected

Member Data Documentation

◆ codec_cfg

CodecConfig codec_cfg
protectedinherited

◆ i2c_default_address

int i2c_default_address = -1
protectedinherited

◆ i2c_retry_count

int i2c_retry_count = 0
protected

◆ p_pins

DriverDeviceInfo* p_pins = nullptr
protectedinherited

◆ volume_in

int volume_in = 100
protected

◆ volume_out

int volume_out = 100
protected

◆ vs1053_enable_pll

bool vs1053_enable_pll = true
protected

◆ vs1053_mclk_hz

uint32_t vs1053_mclk_hz = 0
protected

◆ wm8960

WM8960 wm8960
protected

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