Added support for H2+

This commit is contained in:
jLynx 2022-04-05 14:41:12 +12:00
parent f6c496d1d3
commit fd8bc177ad
3 changed files with 15 additions and 3 deletions

View File

@ -179,18 +179,24 @@ static PortaPackModel portapack_model() {
static Optional<PortaPackModel> model; static Optional<PortaPackModel> model;
if( !model.is_valid() ) { if( !model.is_valid() ) {
if( audio_codec_wm8731.detected() ) { if( audio_codec_wm8731.detected() && audio_codec_ak4951.detected()) {
model = PortaPackModel::R1_20150901; model = PortaPackModel::R2_20170522; // H2+
} else if( audio_codec_wm8731.detected() ) {
model = PortaPackModel::R1_20150901; // H1R1
} else { } else {
model = PortaPackModel::R2_20170522; model = PortaPackModel::R2_20170522; // H1R2
} }
} }
return model.value(); return model.value();
} }
//audio_codec_wm8731 = H1R1 & H2
//audio_codec_ak4951 = H1R2 (China/mine)
static audio::Codec* portapack_audio_codec() { static audio::Codec* portapack_audio_codec() {
/* I2C ready OK, Automatic recognition of audio chip */ /* I2C ready OK, Automatic recognition of audio chip */
// return static_cast<audio::Codec*>(&audio_codec_wm8731);
return (audio_codec_wm8731.detected()) return (audio_codec_wm8731.detected())
? static_cast<audio::Codec*>(&audio_codec_wm8731) ? static_cast<audio::Codec*>(&audio_codec_wm8731)
: static_cast<audio::Codec*>(&audio_codec_ak4951) : static_cast<audio::Codec*>(&audio_codec_ak4951)

View File

@ -115,6 +115,10 @@ void AK4951::init() {
// update(Register::DigitalFilterMode); // update(Register::DigitalFilterMode);
} }
bool AK4951::detected() {
return reset();
}
bool AK4951::reset() { bool AK4951::reset() {
io.audio_reset_state(true); io.audio_reset_state(true);

View File

@ -823,6 +823,8 @@ public:
std::string name() const override { std::string name() const override {
return "AK4951"; return "AK4951";
} }
bool detected();
void init() override; void init() override;
bool reset() override; bool reset() override;