mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-01-13 07:33:39 +00:00
Added button on boot detection
This commit is contained in:
parent
796d9ca854
commit
50821bab55
@ -169,7 +169,7 @@ int main(void) {
|
|||||||
|
|
||||||
sdcStart(&SDCD1, nullptr);
|
sdcStart(&SDCD1, nullptr);
|
||||||
|
|
||||||
controls_init();
|
// controls_init(); // Commented out as now happens in portapack.cpp
|
||||||
lcd_frame_sync_configure();
|
lcd_frame_sync_configure();
|
||||||
rtc_interrupt_enable();
|
rtc_interrupt_enable();
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "hackrf_gpio.hpp"
|
#include "hackrf_gpio.hpp"
|
||||||
using namespace hackrf::one;
|
using namespace hackrf::one;
|
||||||
|
|
||||||
|
|
||||||
#include "clock_manager.hpp"
|
#include "clock_manager.hpp"
|
||||||
#include "event_m0.hpp"
|
#include "event_m0.hpp"
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ using asahi_kasei::ak4951::AK4951;
|
|||||||
#include "cpld_update.hpp"
|
#include "cpld_update.hpp"
|
||||||
|
|
||||||
#include "optional.hpp"
|
#include "optional.hpp"
|
||||||
|
#include "irq_controls.hpp"
|
||||||
|
|
||||||
namespace portapack {
|
namespace portapack {
|
||||||
|
|
||||||
@ -179,12 +181,10 @@ 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() && audio_codec_ak4951.detected()) {
|
if( audio_codec_wm8731.detected() ) {
|
||||||
model = PortaPackModel::R2_20170522; // H2+
|
|
||||||
} else if( audio_codec_wm8731.detected() ) {
|
|
||||||
model = PortaPackModel::R1_20150901; // H1R1
|
model = PortaPackModel::R1_20150901; // H1R1
|
||||||
} else {
|
} else {
|
||||||
model = PortaPackModel::R2_20170522; // H1R2
|
model = PortaPackModel::R2_20170522; // H1R2, H2+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +203,15 @@ static audio::Codec* portapack_audio_codec() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const portapack::cpld::Config& portapack_cpld_config() {
|
static const portapack::cpld::Config& portapack_cpld_config() {
|
||||||
|
|
||||||
|
const auto switches_state = get_switches_state();
|
||||||
|
if (switches_state[(size_t)ui::KeyEvent::Up]){
|
||||||
|
return portapack::cpld::rev_20150901::config;
|
||||||
|
}
|
||||||
|
if (switches_state[(size_t)ui::KeyEvent::Down]){
|
||||||
|
return portapack::cpld::rev_20170522::config;
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
@ -381,6 +390,21 @@ bool init() {
|
|||||||
|
|
||||||
i2c0.start(i2c_config_fast_clock);
|
i2c0.start(i2c_config_fast_clock);
|
||||||
|
|
||||||
|
touch::adc::init();
|
||||||
|
controls_init();
|
||||||
|
|
||||||
|
clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
|
||||||
|
clock_manager.enable_first_if_clock();
|
||||||
|
clock_manager.enable_second_if_clock();
|
||||||
|
clock_manager.enable_codec_clocks();
|
||||||
|
radio::init();
|
||||||
|
|
||||||
|
|
||||||
|
LPC_CREG->DMAMUX = portapack::gpdma_mux;
|
||||||
|
gpdma::controller.enable();
|
||||||
|
|
||||||
|
audio::init(portapack_audio_codec());
|
||||||
|
|
||||||
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;
|
||||||
@ -390,20 +414,6 @@ bool init() {
|
|||||||
chSysHalt();
|
chSysHalt();
|
||||||
}
|
}
|
||||||
|
|
||||||
clock_manager.set_reference_ppb(persistent_memory::correction_ppb());
|
|
||||||
|
|
||||||
audio::init(portapack_audio_codec());
|
|
||||||
|
|
||||||
clock_manager.enable_first_if_clock();
|
|
||||||
clock_manager.enable_second_if_clock();
|
|
||||||
clock_manager.enable_codec_clocks();
|
|
||||||
radio::init();
|
|
||||||
|
|
||||||
touch::adc::init();
|
|
||||||
|
|
||||||
LPC_CREG->DMAMUX = portapack::gpdma_mux;
|
|
||||||
gpdma::controller.enable();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user