Skip to content
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

Remove WM8731 TODO comment #623

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 8 additions & 9 deletions src/dev/codec_wm8731.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ enum CodecSettings
CODEC_FORMAT_MASTER = 0x40,
CODEC_FORMAT_SLAVE = 0x00,
CODEC_FORMAT_INVERT_CLOCK = 0x80,

CODEC_RATE_48K_48K = 0x00 << 2,
CODEC_RATE_8K_8K = 0x03 << 2,
CODEC_RATE_96K_96K = 0x07 << 2,
CODEC_RATE_32K_32K = 0x06 << 2,
CODEC_RATE_44K_44K = 0x08 << 2,
};

Wm8731::Result Wm8731::Init(const Wm8731::Config &config, I2CHandle i2c)
Expand Down Expand Up @@ -149,9 +143,14 @@ Wm8731::Result Wm8731::Init(const Wm8731::Config &config, I2CHandle i2c)
if(res != Result::OK)
return Result::ERR;

// samplerate
// TODO: add support for other samplerates
res = WriteControlRegister(CODEC_REG_SAMPLE_RATE, CODEC_RATE_48K_48K);
// The WM8731 is designed to run from a fixed rate master clock and it
// has its own clock rate conversion mechanisms to derive various sample
// rates from the fixed master clock. In Daisy however we use a variable
// rate master clock generated by the STM32 SAI peripheral so we do not
// want this extra rate conversion. By setting the WM8731 sample rate
// register to 0, we disable the WM8731's own internal sample rate
// conversion.
res = WriteControlRegister(CODEC_REG_SAMPLE_RATE, 0x00);
if(res != Result::OK)
return Result::ERR;

Expand Down