OSCR
Open Source Cartridge Reader
Loading...
Searching...
No Matches
OSCR Namespace Reference

Main program. More...

Namespaces

namespace  Clock
 MCU clock speed methods.
namespace  Cores
 Cores for supported systems
namespace  Menus
 Menu options for internal features.
namespace  Power
 Power/voltage methods.
namespace  Strings
 String constants.
namespace  UI
 User interface methods.
namespace  Util
 Utility methods.

Classes

struct  BrowserFile
 Data struct for the file browser. More...
struct  CoreDefinition
 Metadata for OSCR system cores and main menu options. More...

Typedefs

typedef void(* ConfigCallback) ()

Enumerations

enum class  HW : uint8_t {
  Custom , V1 , V2 , V3 ,
  V4 , V5
}
enum class  ModuleResult : uint8_t { Success , Error , NotEnabled , Unknown }
enum class  ClockSpeed : bool { k16MHz , k8MHz , Full , Half }
enum class  Voltage : uint8_t {
  k5V , k3V3 , Unknown , k5V0 ,
  k3V , Default
}
enum class  SleepState : uint8_t { Awake , Drowsy , Sleep , DeepSleep }
enum class  DataDirection : uint8_t { Unknown , In , Out }
enum class  CoreID : uint8_t {
  NONE , GBX , NES , SNES ,
  N64 , MD , SMS , PCE ,
  WS , NGP , INTV , COLV ,
  VBOY , WSV , PCW , A2600 ,
  ODY2 , ARC , FAIRCHILD , SUPRACAN ,
  MSX , POKE , LOOPY , C64 ,
  A5200 , A7800 , JAGUAR , LYNX ,
  VECTREX , ATARI8 , BALLY , LJ ,
  LJPRO , PV1000 , VIC20 , LEAP ,
  RCA , TI99 , PYUUTA , TRS80 ,
  VSMILE , FLASH8 , CPS3 , SELFTEST
}
 Core IDs. More...
enum class  LanguageID : uint8_t { EN , JA }
 Language IDs.
enum class  RegionID : uint8_t {
  Global , AF , AN , AS ,
  EU , NA , OC , SA
}
 Region IDs. More...
enum class  FeatureID : uint8_t {
  Updater , Config , ClockGen , VSelect ,
  RealTimeClock , ClockGenCalibrated , ClockGenCalibration , OnBoardMega ,
  StabilityFix , PowerSaving
}
 Feature IDs. More...
enum class  OutputInterfaceID : uint8_t { Serial , SerialANSI , SSD1306 , OS12864 }
 Output Interface IDs. More...
enum class  InputInterfaceID : uint8_t {
  Serial , SerialANSI , OneButton , TwoButtons ,
  RotaryButton
}
 Input Interface IDs. More...
enum class  OptionID : uint8_t { LCDType , NeoPixelOrder , VoltageSpecifier , VoltageMonitorMethod }
 Option IDs. More...

Functions

void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::Basic::CRDatabase *crdbTarget)
void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::Basic::CRMapperDatabase *crdbTarget)
void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::Standard::CRDatabase *crdbTarget)
void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::Extended::CRDatabase *crdbTarget)
void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::NES *crdbTarget)
void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::SNES *crdbTarget)
void crdbBrowser (__FlashStringHelper const *title, OSCR::Databases::TI99 *crdbTarget)
void selectFile (__FlashStringHelper const *title, oflag_t oflag)
void selectFile (__FlashStringHelper const *title, OSCR::Storage::File &file, oflag_t oflag, bool useShared=true)
void selectFile (__FlashStringHelper const *title, OSCR::Storage::File &file, oflag_t oflag, char *nameBuff, size_t nameSize, char *pathBuff=nullptr, size_t pathSize=0)
void selectFile (__FlashStringHelper const *title, __FlashStringHelper const *path, OSCR::Storage::File &file, oflag_t oflag, bool useShared=true)
void selectFile (__FlashStringHelper const *title, __FlashStringHelper const *path, OSCR::Storage::File &file, oflag_t oflag, char *nameBuff, size_t nameSize, char *pathBuff=nullptr, size_t pathSize=0)
void log (char const *const message)
void log (__FlashStringHelper const *const message)
void logLine (void)
void logLine (char const *const message)
void logLine (__FlashStringHelper const *const message)
void logLabel (char const *const label, char const *const message)
void logLabel (__FlashStringHelper const *const label, char const *const message)
void logLabel (__FlashStringHelper const *const label, __FlashStringHelper const *const message)
void tick ()
void idle ()
void busy ()
bool wakeEvent ()
void aboutMenu ()
void resetArduino ()
void resetMenu ()

Variables

constexpr HW const kHardwareVersion = ((5 == 0) ? HW:: Custom : HW:: V5 )
constexpr bool const kAdvancedConfiguration = false
constexpr OutputInterfaceID const kHardwareOutput
constexpr InputInterfaceID const kHardwareInput
constexpr uint16_t const kFirmwareFeatures
constexpr LanguageID const kFirmwareLanguage =
constexpr RegionID const kFirmwareRegion
constexpr char const PROGMEM LogFile [] = "/.oscr/logs/"

Detailed Description

Main program.

Enumeration Type Documentation

◆ ClockSpeed

enum class OSCR::ClockSpeed : bool
strong

Enumeration of clock speeds.

Enumerator
k16MHz 

16MHz (ClockScale = 0)

k8MHz 

8MHz (ClockScale = 1)

Full 

Alias of k16MHz

Half 

Alias of k8MHz

◆ CoreID

enum class OSCR::CoreID : uint8_t
strong

Core IDs.

Every core should have a unique ID assigned to it, even if it's not listed on the main menu. These IDs are primarily used by the oscr.tools updater to identify which cores are enabled.

If you just want to change the order of the cores on the menu screen, look at Cores.cpp.

Warning
Do NOT delete/remove or change the order of these. Add new ones at the end!

◆ DataDirection

enum class OSCR::DataDirection : uint8_t
strong

Enumeration of data directions

◆ FeatureID

enum class OSCR::FeatureID : uint8_t
strong

Feature IDs.

Every feature should have a unique ID assigned to it. These IDs are primarily used by the oscr.tools updater to identify which features are enabled.

Warning
Do NOT delete/remove or change the order of these. Add new ones at the end!
Enumerator
Updater 

Support updating via the OSCR.Tools Firmware Updater.

Config 

Allow the use of config.txt.

ClockGen 

Clock Generator.

VSelect 

Automatic Voltage Select (VSELECT) via TPS211x.

RealTimeClock 

RTC Support.

ClockGenCalibrated 

Support for calibrating the clock generator.

ClockGenCalibration 

Load clock generator calibration data.

OnBoardMega 

Enable on-board ATmega2560 options.

StabilityFix 

Fix for ATmega2560s with stability issues at 3.3V.

PowerSaving 

Power Saving.

◆ InputInterfaceID

enum class OSCR::InputInterfaceID : uint8_t
strong

Input Interface IDs.

Every input interface needs a unique ID assigned to it. These IDs are primarily used by the oscr.tools updater to identify which interfaces are enabled.

Warning
Do NOT delete/remove or change the order of these. Add new ones at the end!
Enumerator
Serial 

ASCII Serial.

SerialANSI 

ANSI Serial.

OneButton 

1-button interface (HW1-2)

TwoButtons 

2-button interface (HW3)

RotaryButton 

Rotary-button interface (HW4-5)

◆ ModuleResult

enum class OSCR::ModuleResult : uint8_t
strong

Enumeration for the return values of OSCR modules.

Enumerator
Success 

The method call was successful.

Error 

An error occurred.

NotEnabled 

The module is not enabled or is unavailable

Unknown 

Unknown

◆ OptionID

enum class OSCR::OptionID : uint8_t
strong

Option IDs.

Every major option should have a unique ID assigned to it. These IDs are primarily used by the oscr.tools updater to identify which options are toggled.

Warning
Do NOT delete/remove or change the order of these. Add new ones at the end!

◆ OutputInterfaceID

enum class OSCR::OutputInterfaceID : uint8_t
strong

Output Interface IDs.

Every output interface needs a unique ID assigned to it. These IDs are primarily used by the oscr.tools updater to identify which interfaces are enabled.

Warning
Do NOT delete/remove or change the order of these. Add new ones at the end!
Enumerator
Serial 

ASCII Serial.

SerialANSI 

ANSI Serial.

SSD1306 

OLED.

OS12864 

LCD (a.k.a. MKS/BTT MINI12864, ST7567, etc)

◆ RegionID

enum class OSCR::RegionID : uint8_t
strong

Region IDs.

Enumerator
Global 

All/World/Global.

AF 

Africa.

AN 

Antarctica (for completeness)

AS 

Asia.

EU 

Europe.

NA 

North America.

OC 

Oceania.

SA 

South America.

◆ SleepState

enum class OSCR::SleepState : uint8_t
strong

Enumeration of sleep states

◆ Voltage

enum class OSCR::Voltage : uint8_t
strong

Enumeration of voltages.

Enumerator
k5V 

5V

k3V3 

3.3V

k5V0 

Alias of k5V

k3V 

Alias of k3V3

Default 

Default of k5V (OBMEGA)

Function Documentation

◆ busy()

void OSCR::busy ( )
extern

This doesn't need the checks tick()/idle() do because it's ok if it gets optimized away.

◆ idle()

void OSCR::idle ( )
extern

It's important that the idle() method does not get optimized away because it might be the only method called in loop and if it's optimized away then the while loop itself would be too.

This is not an else because if other methods are added it can either be removed or checks for them need added as well.

Note: This needs to check for other methods that may be valid, even if they aren't enabled, such as Power::idle(), due to the fact they get optimized away if they aren't enbled.

◆ resetArduino()

void OSCR::resetArduino ( )
extern

Just in case this doesn't work, we print a message to inform the user we intend to reset.

◆ tick()

void OSCR::tick ( )
extern

It's important that the tick() method does not get optimized away because tick() might be the only method called inside of a while loop and if it is optimized away then the loop may also be optimized away.

This is not an else because if other methods are added it can either be removed or checks for them need added as well.

Note: This needs to check for other methods that may be valid, even if they aren't enabled, such as Updater::check(), due to the fact they get optimized away if they aren't enbled.

Variable Documentation

◆ kFirmwareFeatures

uint16_t const OSCR::kFirmwareFeatures
inlineconstexpr
Initial value:
=
(1 ? (1 << static_cast<uint32_t>(FeatureID::Updater)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::Config)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::ClockGen)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::ClockGenCalibrated)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::ClockGenCalibration)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::VSelect)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::RealTimeClock)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::OnBoardMega)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::StabilityFix)) : 0) |
(1 ? (1 << static_cast<uint32_t>(FeatureID::PowerSaving)) : 0) |
0
@ ClockGenCalibrated
Support for calibrating the clock generator.
Definition core-types.h:151
@ OnBoardMega
Enable on-board ATmega2560 options.
Definition core-types.h:153
@ VSelect
Automatic Voltage Select (VSELECT) via TPS211x.
Definition core-types.h:149
@ StabilityFix
Fix for ATmega2560s with stability issues at 3.3V.
Definition core-types.h:154
@ ClockGen
Clock Generator.
Definition core-types.h:148
@ Updater
Support updating via the OSCR.Tools Firmware Updater.
Definition core-types.h:146
@ PowerSaving
Power Saving.
Definition core-types.h:155
@ RealTimeClock
RTC Support.
Definition core-types.h:150
@ ClockGenCalibration
Load clock generator calibration data.
Definition core-types.h:152
@ Config
Allow the use of config.txt.
Definition core-types.h:147

◆ kFirmwareRegion

RegionID const OSCR::kFirmwareRegion
inlineconstexpr
Initial value:
=
@ Global
All/World/Global.
Definition core-types.h:124

◆ kHardwareInput

InputInterfaceID const OSCR::kHardwareInput
inlineconstexpr
Initial value:
=
@ OneButton
1-button interface (HW1-2)
Definition core-types.h:190

◆ kHardwareOutput

OutputInterfaceID const OSCR::kHardwareOutput
inlineconstexpr
Initial value:
=
@ Serial
ASCII Serial.
Definition core-types.h:170