mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-12 07:49:32 -05: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() {
|
static const portapack::cpld::Config& portapack_cpld_config() {
|
||||||
|
|
||||||
const auto switches_state = get_switches_state();
|
const auto switches_state = get_switches_state();
|
||||||
if (switches_state[(size_t)ui::KeyEvent::Up]){
|
if (switches_state[(size_t)ui::KeyEvent::Up]){
|
||||||
return portapack::cpld::rev_20150901::config;
|
persistent_memory::set_config_cpld(1);
|
||||||
}
|
|
||||||
if (switches_state[(size_t)ui::KeyEvent::Down]){
|
|
||||||
return portapack::cpld::rev_20170522::config;
|
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)
|
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;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Backlight* backlight() {
|
Backlight* backlight() {
|
||||||
|
@ -82,6 +82,9 @@ struct data_t {
|
|||||||
int32_t afsk_space_freq;
|
int32_t afsk_space_freq;
|
||||||
int32_t modem_baudrate;
|
int32_t modem_baudrate;
|
||||||
int32_t modem_repeat;
|
int32_t modem_repeat;
|
||||||
|
|
||||||
|
// Hardware
|
||||||
|
uint32_t hardware_config;
|
||||||
|
|
||||||
// Play dead unlock
|
// Play dead unlock
|
||||||
uint32_t playdead_magic;
|
uint32_t playdead_magic;
|
||||||
@ -254,6 +257,10 @@ bool config_splash() {
|
|||||||
return data->ui_config & (1 << 31);
|
return data->ui_config & (1 << 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t config_cpld() {
|
||||||
|
return data->hardware_config;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t config_backlight_timer() {
|
uint32_t config_backlight_timer() {
|
||||||
const uint32_t timer_seconds[8] = { 0, 5, 15, 30, 60, 180, 300, 600 };
|
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
|
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);
|
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) {
|
void set_config_backlight_timer(uint32_t i) {
|
||||||
data->ui_config = (data->ui_config & ~7) | (i & 7);
|
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();
|
bool stealth_mode();
|
||||||
void set_stealth_mode(const bool v);
|
void set_stealth_mode(const bool v);
|
||||||
|
|
||||||
|
uint8_t config_cpld();
|
||||||
|
void set_config_cpld(uint8_t i);
|
||||||
|
|
||||||
bool config_splash();
|
bool config_splash();
|
||||||
bool hide_clock();
|
bool hide_clock();
|
||||||
bool clock_with_date();
|
bool clock_with_date();
|
||||||
|
Loading…
Reference in New Issue
Block a user