-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathconfig.h
More file actions
292 lines (249 loc) · 8.79 KB
/
Copy pathconfig.h
File metadata and controls
292 lines (249 loc) · 8.79 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
//
// config.h
//
// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi
// Copyright (C) 2022 The MiniDexed Team
//
// Original author of this class:
// R. Stange <rsta2@o2online.de>
//
// 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/>.
//
#ifndef _config_h
#define _config_h
#include <fatfs/ff.h>
#include <Properties/propertiesfatfsfile.h>
#include <circle/sysconfig.h>
#include <string>
#define SPI_INACTIVE 255
#define SPI_DEF_CLOCK 15000 // kHz
#define SPI_DEF_MODE 0 // Default mode (0,1,2,3)
class CConfig // Configuration for MiniDexed
{
public:
#ifndef ARM_ALLOW_MULTI_CORE
static const unsigned ToneGenerators = 1;
#else
static const unsigned TGsCore1 = 2; // process 2 TGs on core 1
static const unsigned TGsCore23 = 3; // process 3 TGs on core 2 and 3 each
static const unsigned ToneGenerators = TGsCore1 + 2*TGsCore23;
#endif
#if RASPPI == 1
static const unsigned MaxNotes = 8; // polyphony
#else
static const unsigned MaxNotes = 16;
#endif
static const unsigned TGChannels = 2;
static const unsigned MaxChunkSize = 4096;
#if RASPPI <= 3
static const unsigned MaxUSBMIDIDevices = 2;
#else
static const unsigned MaxUSBMIDIDevices = 4;
#endif
// TODO - Leave this for uimenu.cpp for now, but it will need to be dynamic at some point...
static const unsigned LCDColumns = 16; // HD44780 LCD
static const unsigned LCDRows = 2;
public:
CConfig (FATFS *pFileSystem);
~CConfig (void);
void Load (void);
// USB Mode
bool GetUSBGadgetMode (void) const; // true if in USB gadget mode
// Sound device
const char *GetSoundDevice (void) const;
unsigned GetSampleRate (void) const;
unsigned GetChunkSize (void) const;
unsigned GetDACI2CAddress (void) const; // 0 for auto probing
bool GetChannelsSwapped (void) const;
unsigned GetEngineType (void) const;
// MIDI
unsigned GetMIDIBaudRate (void) const;
const char *GetMIDIThruIn (void) const; // "" if not specified
const char *GetMIDIThruOut (void) const; // "" if not specified
bool GetMIDIRXProgramChange (void) const; // true if not specified
bool GetIgnoreAllNotesOff (void) const;
bool GetMIDIAutoVoiceDumpOnPC (void) const; // false if not specified
bool GetHeaderlessSysExVoices (void) const; // false if not specified
bool GetExpandPCAcrossBanks (void) const; // true if not specified
// HD44780 LCD
// GPIO pin numbers are chip numbers, not header positions
bool GetLCDEnabled (void) const;
unsigned GetLCDPinEnable (void) const;
unsigned GetLCDPinRegisterSelect (void) const;
unsigned GetLCDPinReadWrite (void) const; // set to 0 if not connected
unsigned GetLCDPinData4 (void) const;
unsigned GetLCDPinData5 (void) const;
unsigned GetLCDPinData6 (void) const;
unsigned GetLCDPinData7 (void) const;
unsigned GetLCDI2CAddress (void) const;
// SSD1306 LCD
unsigned GetSSD1306LCDI2CAddress (void) const;
unsigned GetSSD1306LCDWidth (void) const;
unsigned GetSSD1306LCDHeight (void) const;
bool GetSSD1306LCDRotate (void) const;
bool GetSSD1306LCDMirror (void) const;
// SPI support
unsigned GetSPIBus (void) const;
unsigned GetSPIMode (void) const;
unsigned GetSPIClockKHz (void) const;
// ST7789 LCD
bool GetST7789Enabled (void) const;
unsigned GetST7789Data (void) const;
unsigned GetST7789Select (void) const;
unsigned GetST7789Reset (void) const;
unsigned GetST7789Backlight (void) const;
unsigned GetST7789Width (void) const;
unsigned GetST7789Height (void) const;
unsigned GetST7789Rotation (void) const;
bool GetST7789SmallFont (void) const;
unsigned GetLCDColumns (void) const;
unsigned GetLCDRows (void) const;
// GPIO Button Navigation
// GPIO pin numbers are chip numbers, not header positions
unsigned GetButtonPinPrev (void) const;
unsigned GetButtonPinNext (void) const;
unsigned GetButtonPinBack (void) const;
unsigned GetButtonPinSelect (void) const;
unsigned GetButtonPinHome (void) const;
unsigned GetButtonPinShortcut (void) const;
// Action type for buttons: "click", "doubleclick", "longpress", ""
const char *GetButtonActionPrev (void) const;
const char *GetButtonActionNext (void) const;
const char *GetButtonActionBack (void) const;
const char *GetButtonActionSelect (void) const;
const char *GetButtonActionHome (void) const;
// Timeouts for button events in milliseconds
unsigned GetDoubleClickTimeout (void) const;
unsigned GetLongPressTimeout (void) const;
// GPIO Button Program and TG Selection
// GPIO pin numbers are chip numbers, not header positions
unsigned GetButtonPinPgmUp (void) const;
unsigned GetButtonPinPgmDown (void) const;
unsigned GetButtonPinTGUp (void) const;
unsigned GetButtonPinTGDown (void) const;
// Action type for buttons: "click", "doubleclick", "longpress", ""
const char *GetButtonActionPgmUp (void) const;
const char *GetButtonActionPgmDown (void) const;
const char *GetButtonActionTGUp (void) const;
const char *GetButtonActionTGDown (void) const;
// MIDI Button Navigation
unsigned GetMIDIButtonCh (void) const;
unsigned GetMIDIButtonNotes (void) const;
unsigned GetMIDIButtonPrev (void) const;
unsigned GetMIDIButtonNext (void) const;
unsigned GetMIDIButtonBack (void) const;
unsigned GetMIDIButtonSelect (void) const;
unsigned GetMIDIButtonHome (void) const;
// MIDI Button Program and TG Selection
unsigned GetMIDIButtonPgmUp (void) const;
unsigned GetMIDIButtonPgmDown (void) const;
unsigned GetMIDIButtonTGUp (void) const;
unsigned GetMIDIButtonTGDown (void) const;
// KY-040 Rotary Encoder
// GPIO pin numbers are chip numbers, not header positions
bool GetEncoderEnabled (void) const;
unsigned GetEncoderPinClock (void) const;
unsigned GetEncoderPinData (void) const;
// Debug
bool GetMIDIDumpEnabled (void) const;
bool GetProfileEnabled (void) const;
// Load performance mode. 0 for load just rotating encoder, 1 load just when Select is pushed
bool GetPerformanceSelectToLoad (void) const;
unsigned GetPerformanceSelectChannel (void) const;
private:
CPropertiesFatFsFile m_Properties;
bool m_bUSBGadgetMode;
std::string m_SoundDevice;
unsigned m_nSampleRate;
unsigned m_nChunkSize;
unsigned m_nDACI2CAddress;
bool m_bChannelsSwapped;
unsigned m_EngineType;
unsigned m_nMIDIBaudRate;
std::string m_MIDIThruIn;
std::string m_MIDIThruOut;
bool m_bMIDIRXProgramChange;
bool m_bIgnoreAllNotesOff;
bool m_bMIDIAutoVoiceDumpOnPC;
bool m_bHeaderlessSysExVoices;
bool m_bExpandPCAcrossBanks;
bool m_bLCDEnabled;
unsigned m_nLCDPinEnable;
unsigned m_nLCDPinRegisterSelect;
unsigned m_nLCDPinReadWrite;
unsigned m_nLCDPinData4;
unsigned m_nLCDPinData5;
unsigned m_nLCDPinData6;
unsigned m_nLCDPinData7;
unsigned m_nLCDI2CAddress;
unsigned m_nSSD1306LCDI2CAddress;
unsigned m_nSSD1306LCDWidth;
unsigned m_nSSD1306LCDHeight;
bool m_bSSD1306LCDRotate;
bool m_bSSD1306LCDMirror;
unsigned m_nSPIBus;
unsigned m_nSPIMode;
unsigned m_nSPIClockKHz;
bool m_bST7789Enabled;
unsigned m_nST7789Data;
unsigned m_nST7789Select;
unsigned m_nST7789Reset;
unsigned m_nST7789Backlight;
unsigned m_nST7789Width;
unsigned m_nST7789Height;
unsigned m_nST7789Rotation;
unsigned m_bST7789SmallFont;
unsigned m_nLCDColumns;
unsigned m_nLCDRows;
unsigned m_nButtonPinPrev;
unsigned m_nButtonPinNext;
unsigned m_nButtonPinBack;
unsigned m_nButtonPinSelect;
unsigned m_nButtonPinHome;
unsigned m_nButtonPinShortcut;
unsigned m_nButtonPinPgmUp;
unsigned m_nButtonPinPgmDown;
unsigned m_nButtonPinTGUp;
unsigned m_nButtonPinTGDown;
std::string m_ButtonActionPrev;
std::string m_ButtonActionNext;
std::string m_ButtonActionBack;
std::string m_ButtonActionSelect;
std::string m_ButtonActionHome;
std::string m_ButtonActionPgmUp;
std::string m_ButtonActionPgmDown;
std::string m_ButtonActionTGUp;
std::string m_ButtonActionTGDown;
unsigned m_nDoubleClickTimeout;
unsigned m_nLongPressTimeout;
unsigned m_nMIDIButtonCh;
unsigned m_nMIDIButtonNotes;
unsigned m_nMIDIButtonPrev;
unsigned m_nMIDIButtonNext;
unsigned m_nMIDIButtonBack;
unsigned m_nMIDIButtonSelect;
unsigned m_nMIDIButtonHome;
unsigned m_nMIDIButtonPgmUp;
unsigned m_nMIDIButtonPgmDown;
unsigned m_nMIDIButtonTGUp;
unsigned m_nMIDIButtonTGDown;
bool m_bEncoderEnabled;
unsigned m_nEncoderPinClock;
unsigned m_nEncoderPinData;
bool m_bMIDIDumpEnabled;
bool m_bProfileEnabled;
bool m_bPerformanceSelectToLoad;
unsigned m_bPerformanceSelectChannel;
};
#endif