mirror of
https://github.com/sanni/cartreader.git
synced 2024-11-10 23:15:08 +01:00
010b7e7525
Lots of changes/additions. Added: * Firmware Updater support: Supports the Firmware Updater app (release to follow soon). Enabled by default, can be disabled in the config. * 3.3V Fix (3V3FIX): Enable if you have stability issues when using 3.3V, works best with VSELECT. Disabled by default, can be enabled in the config. * `DynamicClockSerial`: Class that extends and modifies HardwareSerial to be compatible with a dynamically changing clock speed. Used through the `ClockedSerial` object/variable. * `OSCR.cpp` & `OSCR.h`: New files for storing globals. Only contains these new additions for now. More code cleanup to come. Changed: * Moved configuration flags to `Config.h` and documented them better. * Removed `vselect()` function. Now uses `setVoltage()` with the params `VOLTS_SET_3V3` and `VOLTS_SET_5V`. Known Issues: * Rarely the LCD backlight turns white when using 3V3FIX. Resetting fixes it. Doesn't affect functionality/usability; it's just weird.
34 lines
1.2 KiB
C++
34 lines
1.2 KiB
C++
/********************************************************************
|
|
* Open Source Cartridge Reader *
|
|
********************************************************************/
|
|
#ifndef CLOCKEDSERIAL_H_
|
|
#define CLOCKEDSERIAL_H_
|
|
|
|
#include <HardwareSerial.h>
|
|
#include <HardwareSerial_private.h>
|
|
|
|
/*C******************************************************************
|
|
* NAME : ClockedSerial
|
|
*
|
|
* DESCRIPTION : HardwareSerial wrapper that allows for dynamic clock speed adjustments.
|
|
*
|
|
* USAGE : See HardwareSerial
|
|
*
|
|
* NOTES : If this class isn't used the compiler will optimize it out, so there is
|
|
* no harm in leaving it.
|
|
*C*/
|
|
class DynamicClockSerial : public HardwareSerial
|
|
{
|
|
using HardwareSerial::HardwareSerial;
|
|
public:
|
|
// Various functions to allow parameter omission and automatic handling.
|
|
void begin(unsigned long baud) { begin(baud, SERIAL_8N1, clock); }
|
|
void begin(unsigned long baud, byte config) { begin(baud, config, clock); }
|
|
void begin(unsigned long baud, unsigned long sclock) { begin(baud, SERIAL_8N1, sclock); }
|
|
void begin(unsigned long baud, byte config, unsigned long sclock);
|
|
};
|
|
|
|
extern DynamicClockSerial ClockedSerial;
|
|
|
|
#endif /* CLOCKEDSERIAL_H_ */
|