aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAncyker <[email protected]>2023-07-16 01:01:58 -0400
committerAncyker <[email protected]>2023-07-16 01:01:58 -0400
commitff62f494eb5746e2a7d934fa2384a5d2597032af (patch)
treed30c0fc73c516077038da04ae6b9dbe88b1bb8fb
parent95f4f44786c2620b3b288ff8eafdf00bd7e347d8 (diff)
downloadcartreader-ff62f494eb5746e2a7d934fa2384a5d2597032af.tar.gz
cartreader-ff62f494eb5746e2a7d934fa2384a5d2597032af.zip
Firmware Updates for RTC
Also minor edits to `setVoltage()`
-rw-r--r--Cart_Reader/Cart_Reader.ino16
-rw-r--r--Cart_Reader/OSCR.cpp13
2 files changed, 24 insertions, 5 deletions
diff --git a/Cart_Reader/Cart_Reader.ino b/Cart_Reader/Cart_Reader.ino
index 2b852aa..de38d09 100644
--- a/Cart_Reader/Cart_Reader.ino
+++ b/Cart_Reader/Cart_Reader.ino
@@ -2940,6 +2940,22 @@ void checkUpdater() {
#else
ClockedSerial.println(F("Automatic voltage selection (VSELECT) is not enabled."));
#endif
+ } else if (cmd == "GETTIME") {
+#if defined(RTC_installed)
+ ClockedSerial.print(F("Current Time: "));
+ ClockedSerial.println(RTCStamp());
+#else
+ ClockedSerial.println(F("RTC not installed"));
+#endif
+ } else if (cmd.substring(0,7) == "SETTIME") {
+#if defined(RTC_installed)
+ ClockedSerial.println(F("Setting Time..."));
+ rtc.adjust(DateTime(cmd.substring(8).toInt()));
+ ClockedSerial.print(F("Current Time: "));
+ ClockedSerial.println(RTCStamp());
+#else
+ ClockedSerial.println(F("RTC not installed"));
+#endif
} else {
ClockedSerial.println(F("OSCR: Unknown Command"));
}
diff --git a/Cart_Reader/OSCR.cpp b/Cart_Reader/OSCR.cpp
index 1413276..4f34e93 100644
--- a/Cart_Reader/OSCR.cpp
+++ b/Cart_Reader/OSCR.cpp
@@ -81,6 +81,9 @@ void printVersionToSerial() {
#if defined (ENABLE_VSELECT)
ClockedSerial.print(F("|VSELECT"));
#endif
+ #if defined (RTC_installed)
+ ClockedSerial.print(F("|RTC"));
+ #endif
#if defined (clockgen_installed)
ClockedSerial.print(F("|CLOCKGEN"));
#endif
@@ -169,8 +172,8 @@ void setClockScale(VOLTS __x)
*
*F*/
#if defined(ENABLE_VSELECT) || defined(ENABLE_3V3FIX)
-VOLTS setVoltage(VOLTS volts) {
- switch(volts) {
+VOLTS setVoltage(VOLTS newVoltage) {
+ switch(newVoltage) {
/* 5V */
case VOLTS_SET_5V:
if (
@@ -199,7 +202,7 @@ VOLTS setVoltage(VOLTS volts) {
#endif
// Set clock speed
clock = CS_16MHZ;
- setClockScale(volts); /*[2]*/
+ setClockScale(newVoltage); /*[2]*/
// Restart serial
#if !defined(enable_serial) && defined(ENABLE_UPDATER)
ClockedSerial.begin(UPD_BAUD);
@@ -232,7 +235,7 @@ VOLTS setVoltage(VOLTS volts) {
#endif
// Set clock speed
clock = CS_8MHZ;
- setClockScale(volts); /*[2]*/
+ setClockScale(newVoltage); /*[2]*/
#if !defined(enable_serial) && defined(ENABLE_UPDATER)
ClockedSerial.begin(UPD_BAUD);
#endif
@@ -256,7 +259,7 @@ VOLTS setVoltage(VOLTS volts) {
// The compiler will optimize this out when this condition is met.
// Yes, even though it has a return value it will only be compiled
// if something reads that value. Currently nothing does.
-VOLTS setVoltage(VOLTS volts __attribute__((unused))) {
+VOLTS setVoltage(VOLTS newVoltage __attribute__((unused))) {
return VOLTS_NOTENABLED;
}
#endif