forked from pichenettes/eurorack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.cc
executable file
·82 lines (66 loc) · 1.97 KB
/
settings.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright 2012 Olivier Gillet.
//
// Author: Olivier Gillet (olivier@mutable-instruments.net)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Settings written to eeprom
#include "edges/settings.h"
#include "edges/storage.h"
namespace edges {
/* static */
SettingsData Settings::data_;
/* static */
int16_t Settings::previous_code_[kNumChannels];
/* static */
int16_t Settings::previous_pitch_[kNumChannels];
/* extern */
Settings settings;
typedef SettingsData PROGMEM prog_SettingsData;
const prog_SettingsData init_settings PROGMEM = {
{ { 0, false, false, 3, 0,
{ 512, 1536, 0, 0, 0, 0, 0 }, 1536, 15360, -7680
},
{ 0, false, false, 3, 0,
{ 512, 896, 0, 0, 0, 0, 0 }, 1536, 15360, -7680
},
{ 0, false, false, 4, 0,
{ 512, 896, 1536, 0, 0, 0, 0 }, 1536, 15360, -7680
},
{ 0, false, false, 5, 0,
{ 512, 896, 1536, 3072, 0, 0, 0 }, 1536, 15360, -7680
} },
0,
0
};
template<>
struct StorageLayout<SettingsData> {
static uint16_t eeprom_address() {
return 0;
}
static const prog_char* init_data() {
return (prog_char*)&init_settings;
}
};
/* static */
void Settings::Init(bool reset_to_factory_defaults) {
if (reset_to_factory_defaults) {
storage.ResetToFactoryDefaults(&data_);
} else {
storage.Load(&data_);
}
}
/* static */
void Settings::Save() {
storage.Save(data_);
}
} // namespace edges