From 6c3a1384fb49f9bca1d702088aeb5a6d45293511 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 6 Aug 2017 12:08:12 -0700 Subject: [PATCH] WM8731: Extract interface configuration method. --- firmware/common/wm8731.cpp | 22 +++++++++++++--------- firmware/common/wm8731.hpp | 2 ++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/firmware/common/wm8731.cpp b/firmware/common/wm8731.cpp index 68086d66..2965ad26 100644 --- a/firmware/common/wm8731.cpp +++ b/firmware/common/wm8731.cpp @@ -25,6 +25,18 @@ namespace wolfson { namespace wm8731 { +void WM8731::configure_interface_i2s_slave() { + write(DigitalAudioInterfaceFormat { + .format = 2, + .iwl = 0, + .lrp = 0, + .lrswap = 0, + .ms = 0, + .bclkinv = 0, + .reserved0 = 0, + }); +} + void WM8731::init() { reset(); @@ -49,15 +61,7 @@ void WM8731::init() { // .reserved0 = 0, // }); - write(DigitalAudioInterfaceFormat { - .format = 2, - .iwl = 0, - .lrp = 0, - .lrswap = 0, - .ms = 0, - .bclkinv = 0, - .reserved0 = 0, - }); + configure_interface_i2s_slave(); write(DigitalAudioPathControl { .adchpd = 0, diff --git a/firmware/common/wm8731.hpp b/firmware/common/wm8731.hpp index b2c52778..f4128658 100644 --- a/firmware/common/wm8731.hpp +++ b/firmware/common/wm8731.hpp @@ -375,6 +375,8 @@ private: RegisterMap map { default_after_reset }; volume_t headphone_volume = -60.0_dB; + void configure_interface_i2s_slave(); + bool write(const Register reg); bool write(const address_t reg_address, const reg_t value);