From 37c058354e4c46c1c5394af111b128c366a1c8e3 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 31 May 2017 11:34:16 -0700 Subject: [PATCH] WM8731: Add method to detect codec is present. Used to determine PortaPack hardware version. --- firmware/common/wm8731.cpp | 4 ++++ firmware/common/wm8731.hpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/firmware/common/wm8731.cpp b/firmware/common/wm8731.cpp index b0b27151..e4c01b1b 100644 --- a/firmware/common/wm8731.cpp +++ b/firmware/common/wm8731.cpp @@ -87,6 +87,10 @@ void WM8731::init() { headphone_mute(); } +bool WM8731::detected() { + return reset(); +} + bool WM8731::reset() { return write(0x0f, 0); } diff --git a/firmware/common/wm8731.hpp b/firmware/common/wm8731.hpp index 1f6b3e53..bca090e9 100644 --- a/firmware/common/wm8731.hpp +++ b/firmware/common/wm8731.hpp @@ -292,6 +292,8 @@ public: bool reset(); + bool detected(); + void set_line_in_volume(const volume_t volume) { const auto normalized = line_in_gain_range.normalize(volume); auto n = normalized.centibel() / 15;