From 6d6c6659911033059353aea7f781b109711777cd Mon Sep 17 00:00:00 2001 From: Robin Giese Date: Fri, 28 Aug 2020 15:05:51 -0700 Subject: [PATCH 1/4] Rename TicPin enum values to account for #defines in Particle headers stealing 'SCL' etc. --- Tic.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Tic.h b/Tic.h index 5c53239..7a64ea7 100644 --- a/Tic.h +++ b/Tic.h @@ -228,11 +228,19 @@ enum class TicAgcFrequencyLimit /// This enum defines the Tic's control pins. enum class TicPin { - SCL = 0, - SDA = 1, - TX = 2, - RX = 3, - RC = 4, + SCLPin = 0, + SDAPin = 1, + TXPin = 2, + RXPin = 3, + RCPin = 4, + +#ifdef TIC_ARDUINO_PLAIN_PIN_NAMES + SCL = SCLPin, + SDA = SDAPin, + TX = TXPin, + RX = RXPin, + RC = RCPin, +#endif }; /// This enum defines the Tic's pin states. @@ -1043,7 +1051,7 @@ class TicBase /// /// Example usage: /// ``` - /// uint16_t reading = getAnalogReading(TicPin::SDA); + /// uint16_t reading = getAnalogReading(TicPin::SDAPin); /// if (reading != TicInputNull && reading < 32768) /// { /// // The reading is less than about 2.4 V. @@ -1061,7 +1069,7 @@ class TicBase /// /// Example usage: /// ``` - /// if (tic.getDigitalReading(TicPin::RC)) + /// if (tic.getDigitalReading(TicPin::RCPin)) /// { /// // Something is driving the RC pin high. /// } @@ -1080,7 +1088,7 @@ class TicBase /// Example usage: /// /// ``` - /// if (tic.getPinState(TicPin::SCL) == TicPinState::OutputHigh) + /// if (tic.getPinState(TicPin::SCLPin) == TicPinState::OutputHigh) /// { /// // SCL is driving high. /// } From 958f4c579cc447f44a1ecd615d9d5eae513cadf6 Mon Sep 17 00:00:00 2001 From: Robin Giese Date: Fri, 28 Aug 2020 15:13:25 -0700 Subject: [PATCH 2/4] Adjust Stream call to Spark Stream library typing --- Tic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tic.cpp b/Tic.cpp index 9f22625..50f1881 100644 --- a/Tic.cpp +++ b/Tic.cpp @@ -143,7 +143,7 @@ void TicSerial::getSegment(TicCommand cmd, uint8_t offset, serialW7(offset & 0x7F); serialW7(length | (offset >> 1 & 0x40)); - uint8_t byteCount = _stream->readBytes((uint8_t *)buffer, length); + uint8_t byteCount = _stream->readBytes((char*)buffer, length); if (byteCount != length) { _lastError = 50; From b519beeccdebaf49a029136708e2357da2d039be Mon Sep 17 00:00:00 2001 From: Robin Giese Date: Fri, 28 Aug 2020 18:57:18 -0700 Subject: [PATCH 3/4] Auto-detect whether pre-defined pin name work-around is required --- Tic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tic.h b/Tic.h index 7a64ea7..533e4e4 100644 --- a/Tic.h +++ b/Tic.h @@ -234,7 +234,7 @@ enum class TicPin RXPin = 3, RCPin = 4, -#ifdef TIC_ARDUINO_PLAIN_PIN_NAMES +#ifndef SCL SCL = SCLPin, SDA = SDAPin, TX = TXPin, From 16c734a80427bc9e8c01cfdc1485ee850df7c50d Mon Sep 17 00:00:00 2001 From: Robin Giese Date: Tue, 19 Dec 2023 14:51:20 -0800 Subject: [PATCH 4/4] Unappealing work-around for name collision with Particle/Spark libraries --- Tic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tic.h b/Tic.h index 8bc1edc..8673909 100644 --- a/Tic.h +++ b/Tic.h @@ -122,7 +122,7 @@ enum class TicReset PowerUp = 0, Brownout = 1, ResetLine = 2, - Watchdog = 4, + TicWatchdog = 4, Software = 8, StackOverflow = 16, StackUnderflow = 32,