Added interface argument to termination method

This commit is contained in:
jgromes 2020-05-17 20:26:57 +02:00
parent a969517e04
commit da177c9b2a
2 changed files with 6 additions and 4 deletions

View file

@ -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) // stop hardware interfaces (if they were initialized by the library)
if(!_initInterface) { if(!_initInterface) {
return; return;
} }
if(_spi != nullptr) { if((interface == RADIOLIB_USE_SPI) && (_spi != nullptr)) {
_spi->end(); _spi->end();
} }
if(ModuleSerial != nullptr) { if(((interface == RADIOLIB_USE_UART) && ModuleSerial != nullptr)) {
ModuleSerial->end(); ModuleSerial->end();
} }
} }

View file

@ -159,8 +159,10 @@ class Module {
/*! /*!
\brief Terminate low-level module control. \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 // AT methods