Skip to content

Additional DAC Controls #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ setDacLeftDigitalVolumeDB KEYWORD2
setDacRightDigitalVolumeDB KEYWORD2
enableDacMute KEYWORD2
disableDacMute KEYWORD2
enableDacSoftMute KEYWORD2
disableDacSoftMute KEYWORD2
enableDacSlowSoftMute KEYWORD2
disableDacSlowSoftMute KEYWORD2
setDacDeEmphasis KEYWORD2
enableDacSlopingStopbandFilter KEYWORD2
disableDacSlopingStopbandFilter KEYWORD2
enable3d KEYWORD2
disable3d KEYWORD2
set3dDepth KEYWORD2
Expand Down Expand Up @@ -387,7 +394,11 @@ WM8960_VMIDSEL_2X50KOHM LITERAL1
WM8960_VMIDSEL_2X250KOHM LITERAL1
WM8960_VMIDSEL_2X5KOHM LITERAL1

WM8960_DEEMPH_NONE LITERAL1
WM8960_DEEMPH_32K LITERAL1
WM8960_DEEMPH_44_1K LITERAL1
WM8960_DEEMPH_48K LITERAL1

#######################################
# Instances (KEYWORD3)
#######################################

34 changes: 34 additions & 0 deletions src/SparkFun_WM8960_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,40 @@ boolean WM8960::disableDacMute()
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_1, 3, 0);
}

boolean WM8960::enableDacSoftMute()
{
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_2, 3, 1);
}

boolean WM8960::disableDacSoftMute()
{
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_2, 3, 0);
}

boolean WM8960::enableDacSlowSoftMute()
{
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_2, 2, 1);
}

boolean WM8960::disableDacSlowSoftMute()
{
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_2, 2, 0);
}

// DAC De-Emphasis
boolean WM8960::setDacDeEmphasis(uint8_t setting) {
return WM8960::_writeRegisterMultiBits(WM8960_REG_ADC_DAC_CTRL_1, 2, 1, setting);
}

// DAC Filter
boolean WM8960::enableDacSlopingStopbandFilter() {
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_2, 1, 1);
}

boolean WM8960::disableDacSlopingStopbandFilter() {
return WM8960::_writeRegisterBit(WM8960_REG_ADC_DAC_CTRL_2, 1, 0);
}

// 3D Stereo Enhancement
// 3D enable/disable
boolean WM8960::enable3d()
Expand Down
17 changes: 16 additions & 1 deletion src/SparkFun_WM8960_Arduino_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@
#define WM8960_JACKDETECT_LINPUT3 1
#define WM8960_JACKDETECT_RINPUT3 2

// De-Emphasis settings
#define WM8960_DEEMPH_NONE 0
#define WM8960_DEEMPH_32K 1
#define WM8960_DEEMPH_44_1K 2
#define WM8960_DEEMPH_48K 3

class WM8960
{
public:
Expand Down Expand Up @@ -558,8 +564,17 @@ class WM8960
// DAC mute
boolean enableDacMute();
boolean disableDacMute();
boolean enableDacSoftMute();
boolean disableDacSoftMute();
boolean enableDacSlowSoftMute();
boolean disableDacSlowSoftMute();

// DAC De-Emphasis
boolean setDacDeEmphasis(uint8_t setting);

// DE-Emphasis
// DAC Filter
boolean enableDacSlopingStopbandFilter();
boolean disableDacSlopingStopbandFilter();

// 3D Stereo Enhancement
// 3D enable/disable
Expand Down