From 2ba74d0413d95b86870cc5df9a851e67158c5294 Mon Sep 17 00:00:00 2001 From: jLynx Date: Fri, 8 Apr 2022 12:31:06 +1200 Subject: [PATCH] What did I change? --- firmware/application/portapack.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/firmware/application/portapack.cpp b/firmware/application/portapack.cpp index ccf46f9df..e0a2d9aa7 100644 --- a/firmware/application/portapack.cpp +++ b/firmware/application/portapack.cpp @@ -195,6 +195,21 @@ static PortaPackModel portapack_model() { //audio_codec_ak4951 = H1R2 static audio::Codec* portapack_audio_codec() { + //Remove this after testing + // if (portapack::persistent_memory::config_cpld() == 1) { + // return static_cast(&audio_codec_wm8731); + // } else if (portapack::persistent_memory::config_cpld() == 2) { + // return static_cast(&audio_codec_ak4951); + // } + + const auto switches_state = get_switches_state(); + if (switches_state[(size_t)ui::KeyEvent::Up]){ + return static_cast(&audio_codec_wm8731); + } + if (switches_state[(size_t)ui::KeyEvent::Down]){ + return static_cast(&audio_codec_ak4951); + } + /* I2C ready OK, Automatic recognition of audio chip */ return (audio_codec_wm8731.detected()) ? static_cast(&audio_codec_wm8731) @@ -410,9 +425,13 @@ bool init() { clock_manager.enable_codec_clocks(); radio::init(); + // volatile uint32_t delay2 = 1000000; + // while(delay2--); + if( !portapack::cpld::update_if_necessary(portapack_cpld_config()) ) { // If using a "2021/12 QFP100", press and hold the left button while booting. Should only need to do once. - if (portapack::persistent_memory::config_cpld() != 3){ + const auto switches_state = get_switches_state(); + if (!switches_state[(size_t)ui::KeyEvent::Left] && portapack::persistent_memory::config_cpld() != 3){ shutdown_base(); return false; }