mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Added persistent memory of save state
This commit is contained in:
parent
50821bab55
commit
0c0d47b0d2
@ -203,19 +203,28 @@ static audio::Codec* portapack_audio_codec() {
|
||||
}
|
||||
|
||||
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]){
|
||||
persistent_memory::set_config_cpld(1);
|
||||
return portapack::cpld::rev_20170522::config;
|
||||
}
|
||||
if (switches_state[(size_t)ui::KeyEvent::Down]){
|
||||
persistent_memory::set_config_cpld(2);
|
||||
return portapack::cpld::rev_20150901::config;
|
||||
}
|
||||
if (switches_state[(size_t)ui::KeyEvent::Select]){
|
||||
persistent_memory::set_config_cpld(0);
|
||||
}
|
||||
|
||||
|
||||
if (portapack::persistent_memory::config_cpld() == 1) {
|
||||
return portapack::cpld::rev_20170522::config;
|
||||
} else if (portapack::persistent_memory::config_cpld() == 2) {
|
||||
return portapack::cpld::rev_20150901::config;
|
||||
}
|
||||
return (portapack_model() == PortaPackModel::R2_20170522)
|
||||
? portapack::cpld::rev_20170522::config
|
||||
: portapack::cpld::rev_20150901::config
|
||||
;
|
||||
? portapack::cpld::rev_20170522::config
|
||||
: portapack::cpld::rev_20150901::config;
|
||||
}
|
||||
|
||||
Backlight* backlight() {
|
||||
|
@ -83,6 +83,9 @@ struct data_t {
|
||||
int32_t modem_baudrate;
|
||||
int32_t modem_repeat;
|
||||
|
||||
// Hardware
|
||||
uint32_t hardware_config;
|
||||
|
||||
// Play dead unlock
|
||||
uint32_t playdead_magic;
|
||||
uint32_t playing_dead;
|
||||
@ -254,6 +257,10 @@ bool config_splash() {
|
||||
return data->ui_config & (1 << 31);
|
||||
}
|
||||
|
||||
uint8_t config_cpld() {
|
||||
return data->hardware_config;
|
||||
}
|
||||
|
||||
uint32_t config_backlight_timer() {
|
||||
const uint32_t timer_seconds[8] = { 0, 5, 15, 30, 60, 180, 300, 600 };
|
||||
return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values
|
||||
@ -287,6 +294,10 @@ void set_config_splash(bool v) {
|
||||
data->ui_config = (data->ui_config & ~(1 << 31)) | (v << 31);
|
||||
}
|
||||
|
||||
void set_config_cpld(uint8_t i) {
|
||||
data->hardware_config = i;
|
||||
}
|
||||
|
||||
void set_config_backlight_timer(uint32_t i) {
|
||||
data->ui_config = (data->ui_config & ~7) | (i & 7);
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ void set_playdead_sequence(const uint32_t new_value);
|
||||
bool stealth_mode();
|
||||
void set_stealth_mode(const bool v);
|
||||
|
||||
uint8_t config_cpld();
|
||||
void set_config_cpld(uint8_t i);
|
||||
|
||||
bool config_splash();
|
||||
bool hide_clock();
|
||||
bool clock_with_date();
|
||||
|
Loading…
Reference in New Issue
Block a user