Fixed R1_20150901 vs R2_20170522 boot & detection issues

This commit is contained in:
jLynx 2022-04-05 10:53:52 +12:00
parent 43e9ce4704
commit b4a6b958e5

View File

@ -186,19 +186,12 @@ static PortaPackModel portapack_model() {
} else { } else {
model = PortaPackModel::R2_20170522; model = PortaPackModel::R2_20170522;
} }
// model = PortaPackModel::R1_20150901;
// ToDo: Do validation here to check if R2_20170522 or R1_20150901 (Gen1)
} }
return model.value(); return model.value();
} }
static audio::Codec* portapack_audio_codec() { static audio::Codec* portapack_audio_codec() {
// Maybe we c ould change the model here
/* I2C ready OK, Automatic recognition of audio chip */ /* I2C ready OK, Automatic recognition of audio chip */
return (audio_codec_wm8731.detected()) return (audio_codec_wm8731.detected())
? static_cast<audio::Codec*>(&audio_codec_wm8731) ? static_cast<audio::Codec*>(&audio_codec_wm8731)
@ -207,9 +200,6 @@ static audio::Codec* portapack_audio_codec() {
} }
static const portapack::cpld::Config& portapack_cpld_config() { static const portapack::cpld::Config& portapack_cpld_config() {
// This function here is teh decider if the device boots or not.
// return portapack::cpld::rev_20150901::config; // R1_20150901
return (portapack_model() == PortaPackModel::R2_20170522) return (portapack_model() == PortaPackModel::R2_20170522)
? portapack::cpld::rev_20170522::config ? portapack::cpld::rev_20170522::config
: portapack::cpld::rev_20150901::config : portapack::cpld::rev_20150901::config
@ -217,7 +207,6 @@ static const portapack::cpld::Config& portapack_cpld_config() {
} }
Backlight* backlight() { Backlight* backlight() {
// return static_cast<portapack::Backlight*>(&backlight_on_off); // This should work for R1_20150901
return (portapack_model() == PortaPackModel::R2_20170522) return (portapack_model() == PortaPackModel::R2_20170522)
? static_cast<portapack::Backlight*>(&backlight_cat4004) // R2_20170522 ? static_cast<portapack::Backlight*>(&backlight_cat4004) // R2_20170522
: static_cast<portapack::Backlight*>(&backlight_on_off); // R1_20150901 : static_cast<portapack::Backlight*>(&backlight_on_off); // R1_20150901
@ -329,6 +318,7 @@ bool init() {
i2c0.start(i2c_config_boot_clock); i2c0.start(i2c_config_boot_clock);
// Keeping this here for now incase we need to revert
// if( !portapack::cpld::update_if_necessary(portapack_cpld_config()) ) { // if( !portapack::cpld::update_if_necessary(portapack_cpld_config()) ) {
// shutdown_base(); // shutdown_base();
// return false; // return false;