-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathConfig.h
76 lines (63 loc) · 1.67 KB
/
Config.h
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
#ifndef config_h
#define config_h
// Configuration settings and also "SysInfo"
// auto-run flag bits:
#define AUTO_RUN_BUILTIN 0b00010000
#define AUTO_RUN_EEPROM 0b00100000
// copy EEPROM flags
#define COPY_EEPROM_PRESERVE 0b00010000 // preserve special locations
#define COPY_EEPROM_PAGE 0b00001000 // a page is 256 bytes not slots
class Config
{
public:
enum tItems
{
eClockSeconds,
eClockMinutes,
eClockHours24,
eClockDay,
eClockDate,
eClockMonth,
eClockYear,
eClockControl,
// ------------
eControlFlags,
eControlEEPROMMap,
eControlUser1,
eControlUser2,
eControlUser3,
eControlUser4,
eControlUser5,
eControlAutoRun, // was User6
// ------------
eControlLEDs,
eControlRandom,
eControlDelayMilliSec,
eControlSerial,
// -----------
eEEPROMOffset, // 024
eRAMOffset,
eEEPROMSize,
eEEPROMOverlay,
eEEPROMPage
};
Config();
void Init();
byte Read(byte Item, byte Value=0);
bool Write(byte Item, byte Value);
void SetCPUSpeed(byte Bit);
// configuration settings
bool m_bToggleBits; // if true pressing a Bit button toggles the value, otherwise it only sets it
byte m_iCycleDelayMilliseconds; // delay each cpu "cycle"
byte m_iEEPROMSlotMap; // indicates halving of program slots in EEPROM, see Memory::BuildSlots()
byte m_iAutoRunProgram;
private:
void UpdateFlags(byte Value);
void CheckStartupConfig();
byte ReadFromEEPROM(bool Read, byte EEPROMPage);
byte m_EEPROMOffset;
byte m_RAMOffset;
int m_EEPROMSize;
};
extern Config config;
#endif