OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
config.h
1/********************************************************************
2 * Open Source Cartridge Reader *
3 ********************************************************************/
4#pragma once
5#ifndef OSCR_CONFIG_H_
6# define OSCR_CONFIG_H_
7
8//
9// !!!!! THESE ARE NOT USER-CONFIGURABLE SETTINGS !!!!!
10//
11// This file is intended for developers and advanced users only.
12//
13
14# include "flags.h"
15# include "macros.h"
16
17# if defined(USING_ARDUINO_IDE) || (defined(ARDUINO) && !defined(PLATFORMIO))
18# include "../ArduinoConfig.h"
19# endif
20
21#pragma region README
22
23/*==== INTERNAL DEPENDENCIES ======================================*/
30
31/****/
32
33/* [ Util: Bitset ------------------------------------------------- ]
34 * These allow you to toggle enabling a template to allow using a
35 * bitset for more than 8 bits.
36 */
37
38//#define NEEDS_UTIL_BITSET_TEMPLATE
39//#define NEEDS_UTIL_BITSET_TEMPLATE_16
40//#define NEEDS_UTIL_BITSET_TEMPLATE_32
41//#define NEEDS_UTIL_BITSET_TEMPLATE_64
42
43/****/
44
45/* [ CRDB: Event Hooks -------------------------------------------- ]
46 * These allow you to toggle event hooking for CRDB which allow for
47 * adding core-specific function calls to various events.
48 */
49
50//#define NEEDS_CRDB_EVENTS
51//#define NEEDS_CRDB_EVENT_POSTMATCHCRC
52//#define NEEDS_CRDB_EVENT_POSTRENAMEFILE
53//#define NEEDS_CRDB_EVENT_CRCMATCHFAIL
54//#define NEEDS_CRDB_EVENT_CRCMATCHSUCCESS
55
56/****/
57
58/* [ CRDB: Quiet Flag --------------------------------------------- ]
59 * This flag enables methods to disable CRDB's standard UI output.
60 *
61 * Enables:
62 * * `CRDB::isQuiet()`
63 * * `CRDB::quiet()`
64 */
65//#define NEEDS_CRDB_ISQUIET
66
67/****/
68
69#pragma Doxygen
70
71#if !defined(DOXYGEN)
72# define IS_DOXYGEN false
73#endif
74
75#pragma region Cores
76
77/*==== PREPROCESSOR ===============================================*/
78
79#define MAJOR_VERSION 20
80#define MINOR_VERSION 0
81#define PATCH_VERSION 0
82
83#define CORE_ENABLE_auto 2
84#define CORE_ENABLE_true 1
85#define CORE_ENABLE_false 0
86
87#define CORE_ENABLE_AUTO 2
88#define CORE_ENABLE_TRUE 1
89#define CORE_ENABLE_FALSE 0
90
91#if (defined(WANT_POWERSAVING) && (WANT_POWERSAVING == true))
92# define ENABLE_POWERSAVING
93#endif
94
95#if (defined(WANT_UPDATER) && (WANT_UPDATER == true))
96# define ENABLE_UPDATER
97#endif
98
99#if (defined(WANT_NEOPIXEL) && (WANT_NEOPIXEL == true))
100# define ENABLE_NEOPIXEL
101#endif
102
103#if (CORE_ARC == CORE_ENABLE_TRUE) || ((CORE_ARC == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
104# define ENABLE_ARC
105#endif
106
107#if (CORE_ATARI == CORE_ENABLE_TRUE) || ((CORE_ATARI == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
108# define ENABLE_ATARI
109#endif
110
111#if (CORE_COLV == CORE_ENABLE_TRUE) || ((CORE_COLV == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
112# define ENABLE_COLV
113#endif
114
115#if (CORE_FAIRCHILD == CORE_ENABLE_TRUE) || ((CORE_FAIRCHILD == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
116# define ENABLE_FAIRCHILD
117#endif
118
119#if (CORE_FLASH == CORE_ENABLE_TRUE) || ((CORE_FLASH == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
120# define ENABLE_FLASH
121#endif
122
123#if (CORE_FLASH16 == CORE_ENABLE_TRUE) || ((CORE_FLASH16 == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
124# define ENABLE_FLASH16
125#endif
126
127#if (CORE_GBX == CORE_ENABLE_TRUE) || (CORE_GBX == CORE_ENABLE_AUTO) || (IS_DOXYGEN)
128# define ENABLE_GBX
129#endif
130
131#if (CORE_INTV == CORE_ENABLE_TRUE) || ((CORE_INTV == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
132# define ENABLE_INTV
133#endif
134
135#if (CORE_LOOPY == CORE_ENABLE_TRUE) || ((CORE_LOOPY == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
136# define ENABLE_LOOPY
137#endif
138
139#if (CORE_MD == CORE_ENABLE_TRUE) || (CORE_MD == CORE_ENABLE_AUTO) || (IS_DOXYGEN)
140# define ENABLE_MD
141#endif
142
143#if (CORE_MSX == CORE_ENABLE_TRUE) || ((CORE_MSX == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
144# define ENABLE_MSX
145#endif
146
147#if (CORE_N64 == CORE_ENABLE_TRUE) || (CORE_N64 == CORE_ENABLE_AUTO) || (IS_DOXYGEN)
148# define ENABLE_N64
149#endif
150
151#if (CORE_NES == CORE_ENABLE_TRUE) || (CORE_NES == CORE_ENABLE_AUTO) || (IS_DOXYGEN)
152# define ENABLE_NES
153#endif
154
155#if (CORE_NGP == CORE_ENABLE_TRUE) || ((CORE_NGP == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
156# define ENABLE_NGP
157#endif
158
159#if (CORE_ODY2 == CORE_ENABLE_TRUE) || ((CORE_ODY2 == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
160# define ENABLE_ODY2
161#endif
162
163#if (CORE_PCE == CORE_ENABLE_TRUE) || ((CORE_PCE == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
164# define ENABLE_PCE
165#endif
166
167#if (CORE_PCW == CORE_ENABLE_TRUE) || ((CORE_PCW == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
168# define ENABLE_PCW
169#endif
170
171#if (CORE_POKE == CORE_ENABLE_TRUE) || ((CORE_POKE == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
172# define ENABLE_POKE
173#endif
174
175#if (CORE_SFM == CORE_ENABLE_TRUE) || ((CORE_SFM == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
176# define ENABLE_SFM
177#endif
178
179#if (CORE_SMS == CORE_ENABLE_TRUE) || (CORE_SMS == CORE_ENABLE_AUTO) || (IS_DOXYGEN)
180# define ENABLE_SMS
181#endif
182
183#if (CORE_SNES == CORE_ENABLE_TRUE) || (CORE_SNES == CORE_ENABLE_AUTO) || (IS_DOXYGEN)
184# define ENABLE_SNES
185#endif
186
187#if (CORE_SUPERACAN == CORE_ENABLE_TRUE) || ((CORE_SUPERACAN == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
188# define ENABLE_SUPERACAN
189#endif
190
191#if (CORE_SV == CORE_ENABLE_TRUE) || ((CORE_SV == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
192# define ENABLE_SV
193#endif
194
195#if (CORE_VBOY == CORE_ENABLE_TRUE) || ((CORE_VBOY == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
196# define ENABLE_VBOY
197#endif
198
199#if (CORE_WATARASV == CORE_ENABLE_TRUE) || ((CORE_WATARASV == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
200# define ENABLE_WATARASV
201#endif
202
203#if (CORE_WONDERSWAN == CORE_ENABLE_TRUE) || ((CORE_WONDERSWAN == CORE_ENABLE_AUTO) && (HW_VERSION > 6)) || (IS_DOXYGEN)
204# define ENABLE_WONDERSWAN
205#endif
206
207# if (WANT_VSELECT == true) || (IS_DOXYGEN)
208# define ENABLE_VSELECT
209#endif
210
211# if (WANT_3V3FIX == true) || (IS_DOXYGEN)
212# define ENABLE_3V3FIX
213# endif
214
215# if (WANT_RTC == true) || (IS_DOXYGEN)
216# define ENABLE_RTC
217# endif
218
219# if (WANT_RTC == true) || (IS_DOXYGEN)
220# define ENABLE_CONFIG
221# endif
222
223# if (WANT_CLOCKGEN == true) || (IS_DOXYGEN)
224# define ENABLE_CLOCKGEN
225# endif
226
227# if (USING_ONBOARD_ATMEGA == true) || (IS_DOXYGEN)
228# define ENABLE_ONBOARD_ATMEGA
229# endif
230
231#define VERSION_STRING NUM2STR(MAJOR_VERSION) "." NUM2STR(MINOR_VERSION) "." NUM2STR(PATCH_VERSION)
232
233#pragma region Dependencies
234
235/*==== CORE DEPENDENCIES ==========================================*/
236
237// !! NOTE
238//
239// Core flags have been extended to help make things easier for
240// people to understand. When an `ENABLE` flag is set, any core that
241// requires something from another core should set a `NEEDS` flag
242// for that core. This will enable the functions but omit it from
243// the main menu unless the user specifically enabled it.
244//
245// This also reduces the amount of program memory used by cores the
246// user does not care about even when needed by some other core they
247// do care about.
248//
249// FLAG NAMING CONVENTION
250// * `ENABLE_` is used when the user wants the core enabled. It will
251// appear on menus, etc.
252// * `NEEDS_` is used when a core needs another core to be enabled,
253// but the user didn't neccessarily explicitly ask for it to be
254// enabled. If only `NEEDS` is defined, the core will not appear
255// on menus.
256// * `HAS_` should be set and and can be used when there isn't a
257// difference between the `ENABLE` and `NEEDS` flags.
258//
259// TLDR:
260// When a core can be required by other cores, make sure `HAS_` is
261// defined below when either `ENABLE_` and/or `NEEDS_` is defined
262// and then within the core's source, check `ENABLE_*` for menus,
263// etc., and check `HAS_` for everything else.
264//
265
266/****/
267
271# if defined(ENABLE_CPS3)
272# if !defined(NEEDS_FLASH8)
273# define NEEDS_FLASH8
274# endif
275# if !defined(NEEDS_FLASH16)
276# define NEEDS_FLASH16
277# endif
278# endif
279
280/****/
281
285# if defined(ENABLE_SFM) || defined(ENABLE_SV) || defined(ENABLE_ST) || defined(ENABLE_GPC)
286# if !defined(NEEDS_FLASH8)
287# define NEEDS_SNES
288# endif
289# endif
290
291/****/
292
296# if defined(ENABLE_SNES) && defined(ENABLE_FLASH)
297# if !defined(NEEDS_FLASH8)
298# define NEEDS_FLASH8
299# endif
300# endif
301
302/****/
303
307
308#if defined(ENABLE_FLASH16) && !defined(ENABLED_FLASH8)
309# define ENABLED_FLASH8
310#endif
311
312#if defined(NEEDS_FLASH16) && !defined(NEEDS_FLASH8)
313# define NEEDS_FLASH8
314#endif
315
316/****/
317
318/*==== FINAL PROCESSING & PRESETS =================================*/
319
320#pragma region HAS Flags
321
322/* [ Cores: HAS Flags --------------------------------------------- ]
323 * `HAS_*` is a intended to be a quick way to check if one or both
324 * of `ENABLE_*` and `NEEDS_*` is set.
325 */
326
327# if defined(ENABLE_GBX) || defined(NEEDS_GBX)
328# define HAS_GBX 1
329# else
330# define HAS_GBX 0
331# endif /* ENABLE_GBX || NEEDS_GBX */
332
333# if defined(ENABLE_N64) || defined(NEEDS_N64)
334# define HAS_N64 1
335# else
336# define HAS_N64 0
337# endif /* ENABLE_N64 || NEEDS_N64 */
338
339# if defined(ENABLE_SNES) || defined(NEEDS_SNES)
340# define HAS_SNES 1
341# else
342# define HAS_SNES 0
343# endif /* ENABLE_SNES || NEEDS_SNES */
344
345# if defined(ENABLE_SFM) || defined(NEEDS_SFM)
346# define HAS_SFM 1
347# else
348# define HAS_SFM 0
349# endif /* ENABLE_SFM || NEEDS_SFM */
350
351# if defined(ENABLE_FLASH) || defined(NEEDS_FLASH)
352# define HAS_FLASH 1
353# else
354# define HAS_FLASH 0
355# endif /* ENABLE_FLASH || NEEDS_FLASH */
356
357# if defined(ENABLE_FLASH8) || defined(NEEDS_FLASH8)
358# define HAS_FLASH8 1
359# else
360# define HAS_FLASH8 0
361# endif /* ENABLE_FLASH8 || NEEDS_FLASH8 */
362
363# if defined(ENABLE_FLASH16) || defined(NEEDS_FLASH16)
364# define HAS_FLASH16 1
365# else
366# define HAS_FLASH16 0
367# endif /* ENABLE_FLASH16 || NEEDS_FLASH16 */
368
369# if defined(ENABLE_MD) || defined(NEEDS_MD)
370# define HAS_MD 1
371# else
372# define HAS_MD 0
373# endif /* ENABLE_MD || NEEDS_MD */
374
375# if defined(ENABLE_PCE) || defined(NEEDS_PCE)
376# define HAS_PCE 1
377# else
378# define HAS_PCE 0
379# endif /* ENABLE_PCE || NEEDS_PCE */
380
381# if defined(ENABLE_SV) || defined(NEEDS_SV)
382# define HAS_SV 1
383# else
384# define HAS_SV 0
385# endif /* ENABLE_SV || NEEDS_SV */
386
387# if defined(ENABLE_NES) || defined(NEEDS_NES)
388# define HAS_NES 1
389# else
390# define HAS_NES 0
391# endif /* ENABLE_NES || NEEDS_NES */
392
393# if defined(ENABLE_SMS) || defined(NEEDS_SMS)
394# define HAS_SMS 1
395# else
396# define HAS_SMS 0
397# endif /* ENABLE_SMS || NEEDS_SMS */
398
399# if defined(ENABLE_WS) || defined(NEEDS_WS)
400# define HAS_WS 1
401# else
402# define HAS_WS 0
403# endif /* ENABLE_WS || NEEDS_WS */
404
405# if defined(ENABLE_NGP) || defined(NEEDS_NGP)
406# define HAS_NGP 1
407# else
408# define HAS_NGP 0
409# endif /* ENABLE_NGP || NEEDS_NGP */
410
411# if defined(ENABLE_INTV) || defined(NEEDS_INTV)
412# define HAS_INTV 1
413# else
414# define HAS_INTV 0
415# endif /* ENABLE_INTV || NEEDS_INTV */
416
417# if defined(ENABLE_COLV) || defined(NEEDS_COLV)
418# define HAS_COLV 1
419# else
420# define HAS_COLV 0
421# endif /* ENABLE_COLV || NEEDS_COLV */
422
423# if defined(ENABLE_VBOY) || defined(NEEDS_VBOY)
424# define HAS_VBOY 1
425# else
426# define HAS_VBOY 0
427# endif /* ENABLE_VBOY || NEEDS_VBOY */
428
429# if defined(ENABLE_WSV) || defined(NEEDS_WSV)
430# define HAS_WSV 1
431# else
432# define HAS_WSV 0
433# endif /* ENABLE_WSV || NEEDS_WSV */
434
435# if defined(ENABLE_PCW) || defined(NEEDS_PCW)
436# define HAS_PCW 1
437# else
438# define HAS_PCW 0
439# endif /* ENABLE_PCW || NEEDS_PCW */
440
441# if defined(ENABLE_ODY2) || defined(NEEDS_ODY2)
442# define HAS_ODY2 1
443# else
444# define HAS_ODY2 0
445# endif /* ENABLE_ODY2 || NEEDS_ODY2 */
446
447# if defined(ENABLE_ARC) || defined(NEEDS_ARC)
448# define HAS_ARC 1
449# else
450# define HAS_ARC 0
451# endif /* ENABLE_ARC || NEEDS_ARC */
452
453# if defined(ENABLE_FAIRCHILD) || defined(NEEDS_FAIRCHILD)
454# define HAS_FAIRCHILD 1
455# else
456# define HAS_FAIRCHILD 0
457# endif /* ENABLE_FAIRCHILD || NEEDS_FAIRCHILD */
458
459# if defined(ENABLE_SUPRACAN) || defined(NEEDS_SUPRACAN)
460# define HAS_SUPRACAN 1
461# else
462# define HAS_SUPRACAN 0
463# endif /* ENABLE_SUPRACAN || NEEDS_SUPRACAN */
464
465# if defined(ENABLE_MSX) || defined(NEEDS_MSX)
466# define HAS_MSX 1
467# else
468# define HAS_MSX 0
469# endif /* ENABLE_MSX || NEEDS_MSX */
470
471# if defined(ENABLE_POKE) || defined(NEEDS_POKE)
472# define HAS_POKE 1
473# else
474# define HAS_POKE 0
475# endif /* ENABLE_POKE || NEEDS_POKE */
476
477# if defined(ENABLE_LOOPY) || defined(NEEDS_LOOPY)
478# define HAS_LOOPY 1
479# else
480# define HAS_LOOPY 0
481# endif /* ENABLE_LOOPY || NEEDS_LOOPY */
482
483# if defined(ENABLE_C64) || defined(NEEDS_C64)
484# define HAS_C64 1
485# else
486# define HAS_C64 0
487# endif /* ENABLE_C64 || NEEDS_C64 */
488
489# if defined(ENABLE_2600) || defined(NEEDS_2600)
490# define HAS_2600 1
491# else
492# define HAS_2600 0
493# endif /* ENABLE_2600 || NEEDS_2600 */
494
495# if defined(ENABLE_5200) || defined(NEEDS_5200)
496# define HAS_5200 1
497# else
498# define HAS_5200 0
499# endif /* ENABLE_5200 || NEEDS_5200 */
500
501# if defined(ENABLE_7800) || defined(NEEDS_7800)
502# define HAS_7800 1
503# else
504# define HAS_7800 0
505# endif /* ENABLE_7800 || NEEDS_7800 */
506
507# if defined(ENABLE_JAGUAR) || defined(NEEDS_JAGUAR)
508# define HAS_JAGUAR 1
509# else
510# define HAS_JAGUAR 0
511# endif /* ENABLE_JAGUAR || NEEDS_JAGUAR */
512
513# if defined(ENABLE_LYNX) || defined(NEEDS_LYNX)
514# define HAS_LYNX 1
515# else
516# define HAS_LYNX 0
517# endif /* ENABLE_LYNX || NEEDS_LYNX */
518
519# if defined(ENABLE_VECTREX) || defined(NEEDS_VECTREX)
520# define HAS_VECTREX 1
521# else
522# define HAS_VECTREX 0
523# endif /* ENABLE_VECTREX || NEEDS_VECTREX */
524
525# if defined(ENABLE_ST) || defined(NEEDS_ST)
526# define HAS_ST 1
527# else
528# define HAS_ST 0
529# endif /* ENABLE_ST || NEEDS_ST */
530
531# if defined(ENABLE_GPC) || defined(NEEDS_GPC)
532# define HAS_GPC 1
533# else
534# define HAS_GPC 0
535# endif /* ENABLE_GPC || NEEDS_GPC */
536
537# if defined(ENABLE_ATARI8) || defined(NEEDS_ATARI8)
538# define HAS_ATARI8 1
539# else
540# define HAS_ATARI8 0
541# endif /* ENABLE_ATARI8 || NEEDS_ATARI8 */
542
543# if defined(ENABLE_BALLY) || defined(NEEDS_BALLY)
544# define HAS_BALLY 1
545# else
546# define HAS_BALLY 0
547# endif /* ENABLE_BALLY || NEEDS_BALLY */
548
549# if defined(ENABLE_LJ) || defined(NEEDS_LJ)
550# define HAS_LJ 1
551# else
552# define HAS_LJ 0
553# endif /* ENABLE_LJ || NEEDS_LJ */
554
555# if defined(ENABLE_LJPRO) || defined(NEEDS_LJPRO)
556# define HAS_LJPRO 1
557# else
558# define HAS_LJPRO 0
559# endif /* ENABLE_LJPRO || NEEDS_LJPRO */
560
561# if defined(ENABLE_PV1000) || defined(NEEDS_PV1000)
562# define HAS_PV1000 1
563# else
564# define HAS_PV1000 0
565# endif /* ENABLE_PV1000 || NEEDS_PV1000 */
566
567# if defined(ENABLE_VIC20) || defined(NEEDS_VIC20)
568# define HAS_VIC20 1
569# else
570# define HAS_VIC20 0
571# endif /* ENABLE_VIC20 || NEEDS_VIC20 */
572
573# if defined(ENABLE_LEAP) || defined(NEEDS_LEAP)
574# define HAS_LEAP 1
575# else
576# define HAS_LEAP 0
577# endif /* ENABLE_LEAP || NEEDS_LEAP */
578
579# if defined(ENABLE_RCA) || defined(NEEDS_RCA)
580# define HAS_RCA 1
581# else
582# define HAS_RCA 0
583# endif /* ENABLE_RCA || NEEDS_RCA */
584
585# if defined(ENABLE_TI99) || defined(NEEDS_TI99)
586# define HAS_TI99 1
587# else
588# define HAS_TI99 0
589# endif /* ENABLE_TI99 || NEEDS_TI99 */
590
591# if defined(ENABLE_PYUUTA) || defined(NEEDS_PYUUTA)
592# define HAS_PYUUTA 1
593# else
594# define HAS_PYUUTA 0
595# endif /* ENABLE_PYUUTA || NEEDS_PYUUTA */
596
597# if defined(ENABLE_TRS80) || defined(NEEDS_TRS80)
598# define HAS_TRS80 1
599# else
600# define HAS_TRS80 0
601# endif /* ENABLE_TRS80 || NEEDS_TRS80 */
602
603# if defined(ENABLE_VSMILE) || defined(NEEDS_VSMILE)
604# define HAS_VSMILE 1
605# else
606# define HAS_VSMILE 0
607# endif /* ENABLE_VSMILE || NEEDS_VSMILE */
608
609# if defined(ENABLE_CPS3) || defined(NEEDS_CPS3)
610# define HAS_CPS3 1
611# else
612# define HAS_CPS3 0
613# endif /* ENABLE_CPS3 || NEEDS_CPS3 */
614
615# if defined(ENABLE_SELFTEST) || defined(NEEDS_SELFTEST)
616# define HAS_SELFTEST 1
617# else
618# define HAS_SELFTEST 0
619# endif /* ENABLE_ATARI8 || NEEDS_ATARI8 */
620
621# if defined(NEEDS_UTIL_BITSET_TEMPLATE)
622# define HAS_UTIL_BITSET_TEMPLATE 1
623# endif
624
625/* [ Feature Flags ------------------------------------------------ ]
626 * For features, `HAS_*` falgs are booleans and `HW_VERSION`
627 * contains the numerical value of the hardware version.
628 */
629
630# if defined(ENABLE_UPDATER)
631# define HAS_UPDATER 1
632# else
633# define HAS_UPDATER 0
634# endif
635
636# if defined(ENABLE_CONFIG)
637# define HAS_CONFIG 1
638# else
639# define HAS_CONFIG 0
640# endif
641
642# if defined(ENABLE_CLOCKGEN)
643# define HAS_CLOCKGEN 1
644# else
645# define HAS_CLOCKGEN 0
646# endif
647
648# if defined(ENABLE_VSELECT)
649# define HAS_VSELECT 1
650# else
651# define HAS_VSELECT 0
652# endif
653
654# if defined(ENABLE_RTC)
655# define HAS_RTC 1
656# else
657# define HAS_RTC 0
658# endif
659
660# if defined(ENABLE_ONBOARD_ATMEGA)
661# define HAS_ONBOARD_ATMEGA 1
662# else
663# define HAS_ONBOARD_ATMEGA 0
664# endif
665
666# if defined(ENABLE_3V3FIX)
667# define HAS_STABILITYFIX 1
668# else
669# define HAS_STABILITYFIX 0
670# endif
671
672# if defined(ENABLE_POWERSAVING)
673# define HAS_POWERSAVING 1
674# else
675# define HAS_POWERSAVING 0
676# endif
677
678# if defined(OPTION_CLOCKGEN_CALIBRATION)
679# define HAS_CLOCKGEN_CALIBRATION 1
680# else
681# define HAS_CLOCKGEN_CALIBRATION 0
682# endif
683
684# if defined(OPTION_CLOCKGEN_USE_CALIBRATION)
685# define HAS_CLOCKGEN_CALIBRATED 1
686# else
687# define HAS_CLOCKGEN_CALIBRATED 0
688# endif
689
690/* [ Util: Flags -------------------------------------------------- ]
691 */
692
693#pragma region Presets
694
695# if !defined(OPTION_SERIAL_OUTPUT)
696# define OPTION_SERIAL_OUTPUT SERIAL_ASCII
697# endif
698
699# if !defined(OPTION_LCD_RGB)
700# define OPTION_LCD_RGB 1
701# endif
702
703#define OPTION_LCD_BG_RED 100
704#define OPTION_LCD_BG_GREEN 0
705#define OPTION_LCD_BG_BLUE 100
706
707#define OPTION_LCD_NOTIF_RED 100
708#define OPTION_LCD_NOTIF_GREEN 100
709#define OPTION_LCD_NOTIF_BLUE 0
710
711#define OPTION_LCD_ERROR_RED 100
712#define OPTION_LCD_ERROR_GREEN 0
713#define OPTION_LCD_ERROR_BLUE 0
714
715#pragma region Core Defaults
716
720
721// If adding a new adapter, increase the max here
722# define OPTION_SMS_ADAPTER_MAX 3
723# define OPTION_GG_ADAPTER_MAX 2
724# define OPTION_SG1000_ADAPTER_MAX 1
725
726/****/
727
728#pragma region Defaults
729
730# if defined(ENABLE_CONFIG)
731# define CONFIG_FILE "config.txt"
732// Max length of the key=value pairs
733// Do your best not to have to increase these.
734# define CONFIG_KEY_MAX 32
735# define CONFIG_VALUE_MAX 32
736# endif
737
738/****/
739
740# if !defined(OSCR_REGION)
741# define OSCR_REGION REGN_AUTO
742# endif
743
744/****/
745
746// Unique Directory Method
747
748# if !defined(OPTION_UNIQUE_DIRECTORY_METHOD)
749# define OPTION_UNIQUE_DIRECTORY_METHOD UNQDIR_AUTO
750# elif ISEMPTY(OPTION_UNIQUE_DIRECTORY_METHOD)
751# undef OPTION_UNIQUE_DIRECTORY_METHOD
752# define OPTION_UNIQUE_DIRECTORY_METHOD UNQDIR_AUTO
753# endif
754
755# if (OPTION_UNIQUE_DIRECTORY_METHOD == UNQDIR_AUTO)
756# undef OPTION_UNIQUE_DIRECTORY_METHOD
757# if defined(ENABLE_RTC)
758# define OPTION_UNIQUE_DIRECTORY_METHOD UNQDIR_RTC
759# else
760# define OPTION_UNIQUE_DIRECTORY_METHOD UNQDIR_INCREMENT
761# endif
762# endif
763
764/****/
765
766// Power Saving
767
768# if defined(ENABLE_POWERSAVING)
769
770# if WANT_POWERSAVING_DISPLAY_DIM == true
771# define HAS_POWERSAVING_DISPLAY_DIM POWERSAVING_DISPLAY_DIM
772# else
773# define HAS_POWERSAVING_DISPLAY_DIM 0
774# endif
775
776# if WANT_POWERSAVING_DISPLAY_OFF == true
777# define HAS_POWERSAVING_DISPLAY_OFF POWERSAVING_DISPLAY_OFF
778# else
779# define HAS_POWERSAVING_DISPLAY_OFF 0
780# endif
781
782# if WANT_POWERSAVING_SLOWCLOCK == true
783# define HAS_POWERSAVING_SLOWCLOCK POWERSAVING_SLOWCLOCK
784# else
785# define HAS_POWERSAVING_SLOWCLOCK 0
786# endif
787
788# if ISEMPTY(ENABLE_POWERSAVING)
789# undef ENABLE_POWERSAVING
790# define ENABLE_POWERSAVING 1
791# endif
792
793# if !defined(OPTION_POWERSAVING_METHOD)
794# define OPTION_POWERSAVING_METHOD (HAS_POWERSAVING_DISPLAY_DIM | HAS_POWERSAVING_DISPLAY_OFF | HAS_POWERSAVING_SLOWCLOCK)
795# endif
796
797# if !defined(OPTION_POWERSAVING_IDLE_DIM) || ISEMPTY(OPTION_POWERSAVING_IDLE_DIM)
798# define OPTION_POWERSAVING_IDLE_DIM 30000
799# elif (ISEMPTY(OPTION_POWERSAVING_IDLE_DIM) || OPTION_POWERSAVING_IDLE_DIM < 1000)
800# undef OPTION_POWERSAVING_IDLE_DIM
801# define OPTION_POWERSAVING_IDLE_DIM 30000
802# endif
803
804# if !defined(OPTION_POWERSAVING_IDLE_SLEEP)
805# define OPTION_POWERSAVING_IDLE_SLEEP 60000
806# elif (ISEMPTY(OPTION_POWERSAVING_IDLE_SLEEP) || OPTION_POWERSAVING_IDLE_SLEEP < 1000)
807# undef OPTION_POWERSAVING_IDLE_SLEEP
808# define OPTION_POWERSAVING_IDLE_SLEEP 60000
809# endif
810
811# elif defined(OPTION_POWERSAVING_METHOD)
812# undef OPTION_POWERSAVING_METHOD
813# define OPTION_POWERSAVING_METHOD (0)
814# else
815# define OPTION_POWERSAVING_METHOD (0)
816# endif
817
818# if !defined(OPTION_VOLTAGE_SPECIFIER)
819# define OPTION_VOLTAGE_SPECIFIER VLTSPC_PROMPT
820# endif /* !OPTION_VOLTAGE_SPECIFIER */
821
822/****/
823
827# if HARDWARE_OUTPUT_TYPE == OUTPUT_OS12864
832# define UI_PAGE_SIZE ((uint8_t)7)
833
838# define UI_PAGE_ENTRY_LENTH_MAX ((uint8_t)30)
839
844# define UI_PAGE_ENTRY_LENTH_MIN ((uint8_t)2)
845
846# if defined(OPTION_LCD_TYPE) && OPTION_LCD_TYPE == 0
847# undef OPTION_LCD_TYPE
848# endif
849
850# if !defined(OPTION_LCD_TYPE) || OPTION_LCD_TYPE == 0
851# define OPTION_LCD_TYPE LCD_MKS
852# endif
853
854# if defined(OPTION_NEOPIXEL_ORDER) && OPTION_NEOPIXEL_ORDER == NPXL_AUTO
855# undef OPTION_NEOPIXEL_ORDER
856# endif
857
858# if OPTION_LCD_TYPE == 1 /* Makerbase MINI 12864*/
859# if !defined(OPTION_NEOPIXEL_ORDER)
860# define OPTION_NEOPIXEL_ORDER NPXL_NORMAL
861# endif
862# elif OPTION_LCD_TYPE == 2 /* StarshadeRETRO OSCR 12864 or BigTreeTech MINI 12864*/
863# if !defined(OPTION_NEOPIXEL_ORDER)
864# define OPTION_NEOPIXEL_ORDER NPXL_REVERSE
865# endif
866# if !defined(NO_OPTION_BTN_PULLUP) && !defined(OPTION_BTN_PULLUP_DISABLE)
867# define OPTION_BTN_PULLUP
868# endif
869# else /* OPTION_LCD_TYPE = ? */
870# error !!! INVALID VALUE FOR OPTION_LCD_TYPE !!!
871# endif /* OPTION_LCD_TYPE */
872
873# elif HARDWARE_OUTPUT_TYPE == OUTPUT_SSD1306
877
882# define UI_PAGE_SIZE ((uint8_t)7)
883
888# define UI_PAGE_ENTRY_LENTH_MAX ((uint8_t)20)
889
894# define UI_PAGE_ENTRY_LENTH_MIN ((uint8_t)2)
895
896# elif HARDWARE_OUTPUT_TYPE == OUTPUT_SERIAL
900
905# define UI_PAGE_SIZE ((uint8_t)32)
906
911# define UI_PAGE_ENTRY_LENTH_MAX ((uint8_t)31)
912
917# define UI_PAGE_ENTRY_LENTH_MIN ((uint8_t)2)
918
923# define UI_INPUT_SERIAL_NEXT 'n'
924
929# define UI_INPUT_SERIAL_BACK 'b'
930
935# define UI_INPUT_SERIAL_CONFIRM 'c'
936
941# define UI_INPUT_SERIAL_CONFIRM_SHORT 'x'
942
947# define UI_INPUT_SERIAL_CONFIRM_LONG 'z'
948
953# define UI_INPUT_SERIAL_ANSI_NEXT 0x42
954
959# define UI_INPUT_SERIAL_ANSI_BACK 0x41
960
965# define UI_INPUT_SERIAL_ANSI_CONFIRM 0x43
966
967# if (OPTION_SERIAL_OUTPUT == 1)
968# define ENABLE_SERIAL_OUTPUT
969# define ENABLE_SERIAL_ASCII
970# elif (OPTION_SERIAL_OUTPUT == 2)
971# define ENABLE_SERIAL_OUTPUT
972# define ENABLE_SERIAL_ANSI
973# endif
974
975# endif /* ENABLE_LCD || ENABLE_OLED*/
976
984# define BANKSET_MIN_SUPPORTED_BANKS 4
985
986#pragma region Sanity Checks
987
988/*==== SANITY CHECKS ==============================================*/
989
990// Error if no hardware version is enabled
991# if (HW_VERSION < 1) || (HW_VERSION > 5)
992# error !!! PLEASE CHOOSE HARDWARE VERSION IN CONFIG.H !!!
993# endif
994
995/****/
996
997// Let user know unsafe configs are allowed
998# if defined(ALLOW_UNSAFE_CONFIG)
999// Error if defined during GitHub CI tests. This should not happen unless someone accidentally committed their Config.h
1000# if defined(GITHUB_CI)
1001# error !! UNSAFE CONFIGURATIONS ARE ALLOWED !! -- This should not be enabled on the repository!
1002# else /* !defined(GITHUB_CI) */
1003# warning !! UNSAFE CONFIGURATIONS ARE ALLOWED !! -- Unless you are a developer this probably is not something you want set.
1004# endif /* GITHUB_CI */
1005# endif /* ALLOW_UNSAFE_CONFIG */
1006
1007/****/
1008
1009# if ((OPTION_UNIQUE_DIRECTORY_METHOD < UNQDIR_INCREMENT) || (OPTION_UNIQUE_DIRECTORY_METHOD > UNQDIR_BOTH))
1010# error Unique directory method is invalid.
1011# elif ((OPTION_UNIQUE_DIRECTORY_METHOD == UNQDIR_RTC) || (OPTION_UNIQUE_DIRECTORY_METHOD == UNQDIR_BOTH))
1012# if (!defined(ENABLE_RTC))
1013# error Unique directory method is set to use the datetime, but RTC is not enabled.
1014# endif
1015# endif
1016
1017/****/
1018
1019# if !defined(OSCR_LANGUAGE)
1020# error !!! PLEASE CHOOSE A LANGUAGE !!!
1021# endif
1022
1023# if ((OSCR_LANGUAGE < LANG_MIN) || (OSCR_LANGUAGE > LANG_MAX))
1024# error The language specified in Config.h is invalid.
1025# endif
1026
1027/****/
1028
1029# if defined(OSCR_REGION)
1030# if ((OSCR_REGION < REGN_MIN) || (OSCR_REGION > REGN_MAX))
1031# error The region specified in Config.h is invalid.
1032# endif
1033# endif
1034
1035/****/
1036
1037# if defined(ENABLE_POWERSAVING)
1038# if (((OPTION_POWERSAVING_METHOD) & (POWERSAVING_DISPLAY_DIM | POWERSAVING_DISPLAY_OFF)) && (OPTION_POWERSAVING_IDLE_SLEEP <= OPTION_POWERSAVING_IDLE_DIM))
1039# error Power save sleep timeout must be greater than the dim timeout.
1040# endif
1041# endif
1042
1043/****/
1044
1045# if defined(ENABLE_3V3FIX) && !defined(ENABLE_VSELECT)
1046# warning Using 3V3FIX is best with VSELECT.
1047# endif
1048
1049/****/
1050
1051// Voltage Monitor
1052# if defined(OPTION_VOLTAGE_MONITOR_METHOD)
1053
1054// Error if invalid value
1055# if !(OPTION_VOLTAGE_MONITOR_METHOD >= 0 && OPTION_VOLTAGE_MONITOR_METHOD <= 3)
1056# error !!! VALUE OF OPTION_VOLTAGE_MONITOR_METHOD IS INVALID !!!
1057# endif /* OPTION_VOLTAGE_MONITOR_METHOD <0|>2 */
1058
1059# endif /* OPTION_VOLTAGE_MONITOR_METHOD */
1060
1061/****/
1062
1063// VSELECT
1064# if defined(ENABLE_VSELECT)
1065
1066# if ISEMPTY(ENABLE_VSELECT)
1067# undef ENABLE_VSELECT
1068# define ENABLE_VSELECT 1
1069# endif
1070
1071// Error if not a supported hardware version
1072# if (HW_VERSION < 4)
1073# if defined(ALLOW_UNSAFE_CONFIG)
1074# define IS_UNSAFE_CONFIG
1075# warning Using VSELECT with hardware revisions other than 4 or 5 is not supported.
1076# else /* !defined(ALLOW_UNSAFE_CONFIG) */
1077# error Using VSELECT with hardware revisions other than 4 or 5 is not supported. \
1078 If you understand what you are doing you can define ALLOW_UNSAFE_CONFIG in Config.h to allow compiling.
1079# endif /* ALLOW_UNSAFE_CONFIG */
1080# endif /* !(HW4 | HW5 | SERIAL_MONITOR) */
1081
1082// HW4 might work but needs tested. Make sure they know it's untested.
1083# if HW_VERSION == 4
1084# if defined(ALLOW_UNSAFE_CONFIG)
1085# define IS_UNSAFE_CONFIG
1086# warning Using VSELECT with HW4 is untested. Verification with a multimeter before use is strongly recommended. Please remember to report back with your findings.
1087# else /* !defined(ALLOW_UNSAFE_CONFIG) */
1088# error Using VSELECT with HW4 is untested. Verification with a multimeter before use is strongly recommended. \
1089 Define ALLOW_UNSAFE_CONFIG in Config.h to allow compiling. Please report back with your findings after testing!
1090# endif /* ALLOW_UNSAFE_CONFIG */
1091# endif /* HW4 */
1092
1093# endif /* ENABLE_VSELECT */
1094
1095/****/
1096
1097# if !defined(NEEDS_UTIL_BITSET_TEMPLATE) && (defined(NEEDS_UTIL_BITSET_TEMPLATE_16) || defined(NEEDS_UTIL_BITSET_TEMPLATE_32) || defined(NEEDS_UTIL_BITSET_TEMPLATE_64))
1098# define NEEDS_UTIL_BITSET_TEMPLATE
1099# endif /* !NEEDS_UTIL_BITSET_TEMPLATE && (NEEDS_UTIL_BITSET_TEMPLATE_16 || NEEDS_UTIL_BITSET_TEMPLATE_32 || NEEDS_UTIL_BITSET_TEMPLATE_64)*/
1100
1101/****/
1102
1103# if defined(ENABLE_NEOPIXEL)
1104# if !defined(OPTION_NEOPIXEL_ORDER)
1105# error !!! A VALUE FOR OPTION_NEOPIXEL_ORDER IS REQUIRED !!!
1106# endif
1107
1108# if (!((OPTION_NEOPIXEL_ORDER >= NPXL_AUTO) && (OPTION_NEOPIXEL_ORDER <= NPXL_REVERSE)))
1109# error !!! INVALID VALUE FOR OPTION_NEOPIXEL_ORDER !!!
1110# endif /* OPTION_NEOPIXEL_ORDER */
1111
1112# endif /* ENABLE_NEOPIXEL */
1113
1114/****/
1115
1116/* Firmware updater only works with HW3 and HW5 */
1117# if !(HW_VERSION == 5 || HW_VERSION == 3)
1118# undef ENABLE_UPDATER
1119# endif
1120
1121/****/
1122
1123# if defined(OPTION_VOLTAGE_SPECIFIER)
1124# if defined(ENABLE_VSELECT)
1125# undef OPTION_VOLTAGE_SPECIFIER
1126# define OPTION_VOLTAGE_SPECIFIER VLTSPC_NONE
1127# elif ISEMPTY(OPTION_VOLTAGE_SPECIFIER)
1128# error !!! OPTION_VOLTAGE_SPECIFIER CANNOT BE EMPTY !!!
1129# elif ((OPTION_VOLTAGE_SPECIFIER < 0) || (OPTION_VOLTAGE_SPECIFIER > 3))
1130# error !!! INVALID VALUE FOR OPTION_VOLTAGE_SPECIFIER !!!
1131# endif
1132# endif
1133
1134/****/
1135
1136#pragma region Core Sanity Checks
1137
1138// SMS
1139# if defined(ENABLE_SMS)
1140
1141# if !defined(OPTION_SMS_ADAPTER)
1142# define OPTION_SMS_ADAPTER 0
1143# elif !(OPTION_SMS_ADAPTER >= 0 && OPTION_SMS_ADAPTER <= OPTION_SMS_ADAPTER_MAX)
1144# error !!! INVALID VALUE FOR OPTION_SMS_ADAPTER !!!
1145# endif
1146
1147# if !defined(OPTION_GG_ADAPTER)
1148# define OPTION_GG_ADAPTER 0
1149# elif !(OPTION_GG_ADAPTER >= 0 && OPTION_GG_ADAPTER <= OPTION_GG_ADAPTER_MAX)
1150# error !!! INVALID VALUE FOR OPTION_GG_ADAPTER !!!
1151# endif
1152
1153# if !defined(OPTION_SG1000_ADAPTER)
1154# define OPTION_SG1000_ADAPTER 0
1155# elif !(OPTION_SG1000_ADAPTER >= 0 && OPTION_SG1000_ADAPTER <= OPTION_SG1000_ADAPTER_MAX)
1156# error !!! INVALID VALUE FOR OPTION_SG1000_ADAPTER !!!
1157# endif
1158
1159# endif /* ENABLE_SMS */
1160
1161/****/
1162
1163# if defined(OPTION_PERFORMANCE_FLAGS)
1164# if (OPTION_PERFORMANCE_FLAGS & PRFOPT_CRC32)
1165# define __optimize_crc32 __attribute__((always_inline))
1166# endif
1167# if (OPTION_PERFORMANCE_FLAGS & PRFOPT_FILEWR)
1168# define __optimize_file_write __attribute__((always_inline))
1169# endif
1170# if (OPTION_PERFORMANCE_FLAGS & PRFOPT_FILERD)
1171# define __optimize_file_read __attribute__((always_inline))
1172# endif
1173# if (OPTION_PERFORMANCE_FLAGS & PRFOPT_SHRDFILE)
1174# define __optimize_shared_file __attribute__((always_inline))
1175# endif
1176# if (OPTION_PERFORMANCE_FLAGS & PRFOPT_SPEEDORDEATH)
1177# define OPTION_CRC32_LUT 1
1178# endif
1179# endif
1180
1181# if !defined(__optimize_crc32)
1182# define __optimize_crc32
1183# endif
1184# if !defined(__optimize_file_read)
1185# define __optimize_file_read
1186# endif
1187# if !defined(__optimize_file_write)
1188# define __optimize_file_write
1189# endif
1190# if !defined(__optimize_shared_file)
1191# define __optimize_shared_file
1192# endif
1193# if !defined(OPTION_CRC32_LUT)
1194# define OPTION_CRC32_LUT 0
1195# endif
1196
1197#endif /* OSCR_CONFIG_H_ */
Configuration file for the Arduino IDE.
Define flags for various features/options.