Merge pull request #145 from brentru/add-genericdevice-end

Add end() for GenericDevice
This commit is contained in:
Limor "Ladyada" Fried 2025-06-28 19:34:03 -04:00 committed by GitHub
commit e75ac29ca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 1 deletions

View file

@ -34,6 +34,14 @@ bool Adafruit_GenericDevice::begin(void) {
return true; 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 /*! @brief Write a buffer of data
@param buffer Pointer to buffer of data to write @param buffer Pointer to buffer of data to write
@param len Number of bytes to write @param len Number of bytes to write

View file

@ -27,6 +27,7 @@ public:
busio_genericdevice_writereg_t writereg_func = nullptr); busio_genericdevice_writereg_t writereg_func = nullptr);
bool begin(void); bool begin(void);
void end(void);
bool read(uint8_t *buffer, size_t len); bool read(uint8_t *buffer, size_t len);
bool write(const uint8_t *buffer, size_t len); bool write(const uint8_t *buffer, size_t len);

View file

@ -1,5 +1,5 @@
name=Adafruit BusIO name=Adafruit BusIO
version=1.17.1 version=1.17.2
author=Adafruit author=Adafruit
maintainer=Adafruit <info@adafruit.com> maintainer=Adafruit <info@adafruit.com>
sentence=This is a library for abstracting away UART, I2C and SPI interfacing sentence=This is a library for abstracting away UART, I2C and SPI interfacing