forked from tonuino/TonUINO-TNG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.hpp
297 lines (236 loc) · 11.8 KB
/
constants.hpp
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
293
294
295
296
297
#ifndef SRC_CONSTANTS_HPP_
#define SRC_CONSTANTS_HPP_
#include <Arduino.h>
/* Select the right PCB by uncommenting one of the following lines
* Bitte die passende Platine durch entfernen der Kommentare in einer der folgenden Zeilen auswählen
*/
//#define TonUINO_Classic
//#define TonUINO_Every
//#define ALLinONE
//#define ALLinONE_Plus
/* uncomment one of the below lines to enable special button support
* um die Tasten zu konfigurieren, bitte eine der nächsten Zeilen auskommentieren
* default: THREEBUTTONS for classic/every
* FIVEBUTTONS for AiO and AiO+
*/
//#define THREEBUTTONS
//#define FIVEBUTTONS
//#define BUTTONS3X3
/* uncomment the below line to enable serial input as additional command source
* um den Serial Monitor als zusätzliche Kommandoquelle zu haben bitte in der nächste Zeile den Kommentar entfernen
* -7: -8: up -9: upLong
* -4: allLong -5: pause -6: pauseLong
* -1: up/downLong -2: down -3: downLong
* number n > 0: Springe im Voice Menü zum n-ten Eintrag und selektiere ihn
*/
#define SerialInputAsCommand
/* uncomment one of the below lines to support a special chip on the DfMiniMp3 player
* um einen speziellen Chip auf dem DfMiniMp3 Player zu ünterstützen bitte in eine der nächste Zeilen den Kommentar entfernen
*/
//#define DFMiniMp3_T_CHIP_GD3200B
//#define DFMiniMp3_T_CHIP_MH2024K16SS
//#define DFMiniMp3_T_CHIP_LISP3
#define DFMiniMp3_T_CHIP_Mp3ChipIncongruousNoAck
/* uncomment the below line to disable shutdown via button (long press play/pause)
* um ein Shutdown via Taste (long press Play/Pause) zu unterdrücken bitte in der nächste Zeile den Kommentar entfernen
*/
//#define DISABLE_SHUTDOWN_VIA_BUTTON
/* uncomment the below line to enable the rotary encoder for volume setting (only for AiOplus)
* um den Drehgeber zu unterstützen bitte in der nächste Zeile den Kommentar entfernen (nur für AioPlus)
*/
//#define ROTARY_ENCODER
inline constexpr uint8_t rotaryEncoderClkPin = 31;
inline constexpr uint8_t rotaryEncoderDtPin = 32;
/* uncomment the below line to enable the poti for volume setting
* um den Poti zu unterstützen bitte in der nächste Zeile den Kommentar entfernen
*/
//#define POTI
//inline constexpr uint8_t potiPin = A14; // AiO+ PF4
/* uncomment the below line to enable the neo ring
* um den Neo Ring zu unterstützen bitte in der nächste Zeile den Kommentar entfernen
*/
//#define NEO_RING
inline constexpr uint8_t neoPixelRingPin = 10; // PB2 on AiOplus
inline constexpr uint8_t neoPixelNumber = 24; // Total Number of Pixels
/* uncomment the below line to enable the Speaker on/off on Pin D6 for Classic to suppress noise
* on startup and shutdown
* um den Lautsprecher ein/aus Schalter über D6 für die Classic Variante zu unterstützen bitte
* in der nächste Zeile den Kommentar entfernen (zur Unterdrückung der Ein- und Ausschaltgeräusche)
*/
//#define SPKONOFF
/* #################################################################################################
* ##### normally, you don't have to edit lines below ############################
* ##### mormalerweise müssen die folgende Zeilen nicht editiert werden ############################
* #################################################################################################
*/
// ####### helper for level ############################
enum class level : uint8_t {
inactive,
active ,
};
enum class levelType : uint8_t {
activeHigh, // normally open
activeLow , // normally closed
};
inline constexpr int getLevel(levelType t, level l) { return (l == level::inactive) ? (t == levelType::activeHigh ? LOW : HIGH)
: (t == levelType::activeHigh ? HIGH : LOW); }
// ####### rules for buttons ############################
#ifdef BUTTONS3X3
#ifdef FIVEBUTTONS
static_assert(false, "The 3x3 Button board doesn't have 5 Buttons");
#endif
inline constexpr uint8_t buttonExtSC_begin = 101;
inline constexpr uint8_t buttonExtSC_buttons = 18;
#endif // BUTTONS3X3
inline constexpr uint32_t buttonLongPress = 1000; // timeout for long press button in ms
inline constexpr uint32_t buttonLongPressRepeat = 200; // timeout for long press button repeat in ms
/***************************************************************************
** Classic ****************************************************************
***************************************************************************/
#if defined(TonUINO_Classic) or defined(TonUINO_Every)
// ####### buttons #####################################
inline constexpr uint8_t buttonPausePin = A0;
#if defined(BUTTONS3X3)
inline constexpr uint8_t button3x3Pin = A3;
inline constexpr uint8_t buttonUpPin = A1;
inline constexpr uint8_t buttonDownPin = A2;
inline constexpr uint32_t button3x3DbTime = 50; // Debounce time in milliseconds (default 50ms)
#elif defined(FIVEBUTTONS)
inline constexpr uint8_t buttonUpPin = A3;
inline constexpr uint8_t buttonDownPin = A4;
inline constexpr uint8_t buttonFourPin = A1;
inline constexpr uint8_t buttonFivePin = A2;
#else
inline constexpr uint8_t buttonUpPin = A1;
inline constexpr uint8_t buttonDownPin = A2;
#endif
inline constexpr levelType buttonPinType = levelType::activeLow;
inline constexpr uint32_t buttonDbTime = 25; // Debounce time in milliseconds (default 25ms)
// ####### chip_card ###################################
inline constexpr uint32_t cardCookie = 0x1337b347;
inline constexpr uint8_t cardVersion = 0x02;
inline constexpr byte mfrc522_RSTPin = 9;
inline constexpr byte mfrc522_SSPin = 10;
inline constexpr uint8_t cardRemoveDelay = 3;
// ####### mp3 #########################################
#define DFPlayerUsesSoftwareSerial
#define CHECK_MISSING_ONPLAYFINISHED
inline constexpr uint8_t maxTracksInFolder = 255;
inline constexpr uint8_t dfPlayer_receivePin = 2;
inline constexpr uint8_t dfPlayer_transmitPin = 3;
inline constexpr uint8_t dfPlayer_busyPin = 4;
inline constexpr levelType dfPlayer_busyPinType = levelType::activeHigh;
inline constexpr unsigned long dfPlayer_timeUntilStarts = 1000;
// ####### tonuino #####################################
inline constexpr uint8_t shutdownPin = 7;
inline constexpr levelType shutdownPinType = levelType::activeHigh;
inline constexpr uint8_t ampEnablePin = 6;
inline constexpr levelType ampEnablePinType = levelType::activeHigh;
inline constexpr uint8_t openAnalogPin = A7;
inline constexpr unsigned long cycleTime = 50;
#endif /* TonUINO_Classic or TonUINO_Every */
/***************************************************************************
** AiO plus ***************************************************************
***************************************************************************/
#ifdef ALLinONE_Plus
// ####### buttons #####################################
#if not defined(THREEBUTTONS) and not defined(BUTTONS3X3)
#define FIVEBUTTONS
#endif
inline constexpr uint8_t buttonPausePin = A0;
#ifdef BUTTONS3X3
inline constexpr uint8_t button3x3Pin = A2;
inline constexpr uint8_t buttonUpPin = A4;
inline constexpr uint8_t buttonDownPin = A3;
inline constexpr uint32_t button3x3DbTime = 50; // Debounce time in milliseconds (default 50ms)
#else
inline constexpr uint8_t buttonUpPin = A2;
inline constexpr uint8_t buttonDownPin = A1;
#endif
#ifdef FIVEBUTTONS
inline constexpr uint8_t buttonFourPin = A4;
inline constexpr uint8_t buttonFivePin = A3;
#endif
inline constexpr levelType buttonPinType = levelType::activeLow;
inline constexpr uint32_t buttonDbTime = 25; // Debounce time in milliseconds (default 25ms)
// ####### chip_card ###################################
inline constexpr uint32_t cardCookie = 0x1337b347;
inline constexpr uint8_t cardVersion = 0x02;
inline constexpr byte mfrc522_RSTPin = 11;
inline constexpr byte mfrc522_SSPin = 7;
inline constexpr uint8_t cardRemoveDelay = 3;
// ####### mp3 #########################################
#define DFPlayerUsesHardwareSerial
#define CHECK_MISSING_ONPLAYFINISHED
inline constexpr uint8_t maxTracksInFolder = 255;
// inline constexpr uint8_t dfPlayer_receivePin = 2;
// inline constexpr uint8_t dfPlayer_transmitPin = 3;
inline constexpr uint8_t dfPlayer_busyPin = 13;
inline constexpr levelType dfPlayer_busyPinType = levelType::activeHigh;
inline constexpr unsigned long dfPlayer_timeUntilStarts = 1000;
inline constexpr HardwareSerial &dfPlayer_serial = Serial3;
// ####### tonuino #####################################
inline constexpr uint8_t shutdownPin = 27;
inline constexpr levelType shutdownPinType = levelType::activeLow;
inline constexpr uint8_t ampEnablePin = 19;
inline constexpr levelType ampEnablePinType = levelType::activeLow;
inline constexpr uint8_t usbAccessPin = 20;
inline constexpr levelType usbAccessPinType = levelType::activeHigh;
inline constexpr uint8_t openAnalogPin = A7;
inline constexpr unsigned long cycleTime = 50;
#endif /* ALLinONE_Plus */
/***************************************************************************
** AiO ********************************************************************
***************************************************************************/
#ifdef ALLinONE
// ####### buttons #####################################
#if not defined(THREEBUTTONS) and not defined(BUTTONS3X3)
#define FIVEBUTTONS
#endif
inline constexpr uint8_t buttonPausePin = A0;
#ifdef BUTTONS3X3
inline constexpr uint8_t button3x3Pin = A2;
inline constexpr uint8_t buttonUpPin = A4;
inline constexpr uint8_t buttonDownPin = A3;
inline constexpr uint32_t button3x3DbTime = 50; // Debounce time in milliseconds (default 50ms)
#else
inline constexpr uint8_t buttonUpPin = A2;
inline constexpr uint8_t buttonDownPin = A1;
#endif
#ifdef FIVEBUTTONS
inline constexpr uint8_t buttonFourPin = A4;
inline constexpr uint8_t buttonFivePin = A3;
#endif
inline constexpr levelType buttonPinType = levelType::activeLow;
inline constexpr uint32_t buttonDbTime = 25; // Debounce time in milliseconds (default 25ms)
// ####### chip_card ###################################
inline constexpr uint32_t cardCookie = 0x1337b347;
inline constexpr uint8_t cardVersion = 0x02;
inline constexpr byte mfrc522_RSTPin = 9;
inline constexpr byte mfrc522_SSPin = 10;
inline constexpr uint8_t cardRemoveDelay = 3;
// ####### mp3 #########################################
#define DFPlayerUsesSoftwareSerial
#define CHECK_MISSING_ONPLAYFINISHED
inline constexpr uint8_t maxTracksInFolder = 255;
inline constexpr uint8_t dfPlayer_receivePin = 2;
inline constexpr uint8_t dfPlayer_transmitPin = 3;
inline constexpr uint8_t dfPlayer_busyPin = 4;
inline constexpr levelType dfPlayer_busyPinType = levelType::activeHigh;
inline constexpr unsigned long dfPlayer_timeUntilStarts = 1000;
// ####### tonuino #####################################
inline constexpr uint8_t shutdownPin = 7;
inline constexpr levelType shutdownPinType = levelType::activeLow;
inline constexpr uint8_t ampEnablePin = 8;
inline constexpr levelType ampEnablePinType = levelType::activeLow;
inline constexpr uint8_t usbAccessPin = A5;
inline constexpr levelType usbAccessPinType = levelType::activeHigh;
inline constexpr uint8_t openAnalogPin = A7;
inline constexpr unsigned long cycleTime = 50;
#endif /* ALLinONE */
// ####### some helper fuctions #####################################
template <typename T> void PROGMEM_read(const T * sce, T& dest)
{
memcpy_P (&dest, sce, sizeof (T));
}
#endif /* SRC_CONSTANTS_HPP_ */