Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
arduino-RCS620S.zip が使用するシリアルポートを変更可能にする修正です。
diff --git a/firmware/RCS620S/RCS620S.h b/firmware/RCS620S/RCS620S.h
index 9792859..f2a17c0 100644
--- a/firmware/RCS620S/RCS620S.h
+++ b/firmware/RCS620S/RCS620S.h
@@ -16,6 +16,15 @@
#define RCS620S_MAX_CARD_RESPONSE_LEN 254
#define RCS620S_MAX_RW_RESPONSE_LEN 265
+
+/*
+ for default Serial port, use Serial
+ for TX1/RX1, use Serial1
+ for TX2/RX2, use Serial2
+ for TX3/RX3, use Serial3
+*/
+#define SERIAL_RCS620S Serial1
+
/* --------------------------------
* Class Declaration
* -------------------------------- */
diff --git a/firmware/RCS620S/RCS620S.cpp b/firmware/RCS620S/RCS620S.cpp
index fe9eb01..bf0f776 100644
--- a/firmware/RCS620S/RCS620S.cpp
+++ b/firmware/RCS620S/RCS620S.cpp
@@ -309,7 +309,7 @@ void RCS620S::writeSerial(
const uint8_t* data,
uint16_t len)
{
- Serial.write(data, len);
+ SERIAL_RCS620S.write(data, len);
}
int RCS620S::readSerial(
@@ -324,8 +324,8 @@ int RCS620S::readSerial(
return 0;
}
- if (Serial.available() > 0) {
- data[nread] = Serial.read();
+ if (SERIAL_RCS620S.available() > 0) {
+ data[nread] = SERIAL_RCS620S.read();
nread++;
}
}
@@ -335,7 +335,7 @@ int RCS620S::readSerial(
void RCS620S::flushSerial(void)
{
- Serial.flush();
+ SERIAL_RCS620S.flush();
}
int RCS620S::checkTimeout(unsigned long t0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment