OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
Types.h
1#pragma once
2#ifndef OSCR_TYPES_H_
3#define OSCR_TYPES_H_
4
5#include <stdint.h>
6#include "config.h"
7#include "core-types.h"
8#include "common/crc32_t.h"
9
10namespace OSCR
11{
12 typedef void (*ConfigCallback)();
13
14 enum class HW : uint8_t
15 {
16 Custom,
17 V1,
18 V2,
19 V3,
20 V4,
21 V5,
22 };
23
32 {
33 CoreID const id = CoreID::NONE;
34 char const * title;
35 void (*menu)();
36 };
37
41 enum class ModuleResult : uint8_t
42 {
47 };
48
52 enum class ClockSpeed : bool
53 {
55 k16MHz = 0,
57 k8MHz = 1,
62 };
63
67 enum class Voltage : uint8_t
68 {
71 Unknown,
72
77
79#if defined(ENABLE_ONBOARD_ATMEGA)
81#else /* !ENABLE_ONBOARD_ATMEGA */
82 Default = k3V3,
83#endif /* ENABLE_ONBOARD_ATMEGA */
84 };
85
89 enum class SleepState : uint8_t
90 {
91 Awake,
92 Drowsy,
93 Sleep,
94 DeepSleep,
95 };
96
100 enum class DataDirection : uint8_t
101 {
102 Unknown,
103 In,
104 Out,
105 };
106
111 {
112 uint32_t index;
113 char name[UI_FILE_BROWSER_FILENAME_MAX + 1];
114 bool isDir = false;
115 };
116
117 namespace UI
118 {
122 enum UserInput: uint8_t
123 {
124 kUserInputIgnore,
125 kUserInputConfirm,
126 kUserInputNext,
127 kUserInputBack,
128 kUserInputConfirmShort,
129 kUserInputConfirmLong,
130 kUserInputUnknown,
131 };
132
136 enum InterfaceInput: uint8_t
137 {
138 kInterfaceInputIgnore,
139 kInterfaceInputPress,
140 kInterfaceInputPressDouble,
141 kInterfaceInputPressShort,
142 kInterfaceInputPressLong,
143 };
144
148 enum NavDir: bool
149 {
150 kNavDirBackward,
151 kNavDirForward,
152 };
153
157 struct rgb_t
158 {
159 uint8_t red;
160 uint8_t green;
161 uint8_t blue;
162 };
163
167 enum MenuMode: uint8_t
168 {
169 kMenuFlashString,
170 kMenuRamFlashString,
171 kMenuOptionStruct,
172 kMenuNullChar,
173 kMenuFlashStringTemplate,
174 kMenuIntegerTemplate,
175 };
176
177 }
178
179 namespace Serial
180 {
181 enum class Style : uint8_t
182 {
183 Reset = 0,
184 Bold, // also called "Bright"
185 Faint, // ECMA-48
186 Italic,
187 Underline,
188 Blink,
189 // 6 = Unused
190 Inverse = 7,
191 Invisible, // ECMA-48
192 Strikethrough, // ECMA-48
193 };
194
195 enum class Foreground : uint8_t
196 {
197 Black = 30,
198 Red,
199 Green,
200 Yellow,
201 Blue,
202 Magenta,
203 Cyan,
204 White,
205 Default, // ECMA-48
206 };
207
208 enum class Background : uint8_t
209 {
210 Black = 40,
211 Red,
212 Green,
213 Yellow,
214 Blue,
215 Magenta,
216 Cyan,
217 White,
218 Default, // ECMA-48
219 };
220
221 union Format
222 {
223 uint8_t value;
224 Style style;
225 Foreground foreground;
226 Background background;
227 };
228
229 enum class Cursor: bool
230 {
231 Show,
232 Hide,
233 };
234 }
235}
236
237#endif /* OSCR_TYPES_H_ */
Define core and feature IDs.
User interface methods.
Definition Types.h:118
NavDir
Definition Types.h:149
InterfaceInput
Definition Types.h:137
MenuMode
Definition Types.h:168
UserInput
Definition Types.h:123
Main program.
Definition Storage.h:13
ModuleResult
Definition Types.h:42
@ NotEnabled
Definition Types.h:45
@ Success
Definition Types.h:43
@ Unknown
Definition Types.h:46
@ Error
Definition Types.h:44
DataDirection
Definition Types.h:101
Voltage
Definition Types.h:68
@ k3V
Definition Types.h:76
@ k5V
Definition Types.h:69
@ Default
Definition Types.h:80
@ k5V0
Definition Types.h:74
@ k3V3
Definition Types.h:70
@ Serial
ASCII Serial.
Definition core-types.h:170
ClockSpeed
Definition Types.h:53
@ k16MHz
Definition Types.h:55
@ Full
Definition Types.h:59
@ Half
Definition Types.h:61
@ k8MHz
Definition Types.h:57
CoreID
Core IDs.
Definition core-types.h:63
SleepState
Definition Types.h:90
Data struct for the file browser.
Definition Types.h:111
Metadata for OSCR system cores and main menu options.
Definition Types.h:32
A structured RGB value.
Definition Types.h:158
Definition Types.h:222