From d8a04619f0b5d5e85ffe4655f22e9f86b96f7d4a Mon Sep 17 00:00:00 2001 From: brentru Date: Wed, 18 Jun 2025 16:01:02 -0400 Subject: [PATCH] Add - end() for GenericDevice --- Adafruit_GenericDevice.cpp | 8 ++++++++ Adafruit_GenericDevice.h | 1 + library.properties | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Adafruit_GenericDevice.cpp b/Adafruit_GenericDevice.cpp index 7fe5a10..37f9cfd 100644 --- a/Adafruit_GenericDevice.cpp +++ b/Adafruit_GenericDevice.cpp @@ -34,6 +34,14 @@ bool Adafruit_GenericDevice::begin(void) { return true; } +/*! +@brief Marks the GenericDevice as no longer in use. +@note: Since this is a GenericDevice, if you are using this with a Serial +object, this does NOT disable serial communication or release the RX/TX pins. +That must be done manually by calling Serial.end(). +*/ +void Adafruit_GenericDevice::end(void) { _begun = false; } + /*! @brief Write a buffer of data @param buffer Pointer to buffer of data to write @param len Number of bytes to write diff --git a/Adafruit_GenericDevice.h b/Adafruit_GenericDevice.h index 14bb8ae..d5cb326 100644 --- a/Adafruit_GenericDevice.h +++ b/Adafruit_GenericDevice.h @@ -27,6 +27,7 @@ public: busio_genericdevice_writereg_t writereg_func = nullptr); bool begin(void); + void end(void); bool read(uint8_t *buffer, size_t len); bool write(const uint8_t *buffer, size_t len); diff --git a/library.properties b/library.properties index 4f283cb..0dd66ed 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit BusIO -version=1.17.1 +version=1.17.2 author=Adafruit maintainer=Adafruit sentence=This is a library for abstracting away UART, I2C and SPI interfacing