diff --git a/src/Module.cpp b/src/Module.cpp index ff03b1f3..b4db0504 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -102,17 +102,17 @@ void Module::init(uint8_t interface) { } } -void Module::term() { +void Module::term(uint8_t interface) { // stop hardware interfaces (if they were initialized by the library) if(!_initInterface) { return; } - if(_spi != nullptr) { + if((interface == RADIOLIB_USE_SPI) && (_spi != nullptr)) { _spi->end(); } - if(ModuleSerial != nullptr) { + if(((interface == RADIOLIB_USE_UART) && ModuleSerial != nullptr)) { ModuleSerial->end(); } } diff --git a/src/Module.h b/src/Module.h index 12247f3c..a77d1a7e 100644 --- a/src/Module.h +++ b/src/Module.h @@ -159,8 +159,10 @@ class Module { /*! \brief Terminate low-level module control. + + \param interface Interface to be terminated. See \ref shield_config for details. */ - void term(); + void term(uint8_t interface); // AT methods