1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

HAL minor simplification

This commit is contained in:
Asbelos 2022-06-14 17:50:57 +01:00
parent 6b7c2ccdf0
commit 3496b99197
3 changed files with 2 additions and 8 deletions

View File

@ -294,7 +294,7 @@ bool IODevice::checkNoOverlap(VPIN firstPin, uint8_t nPins, uint8_t i2cAddress)
}
// Check for overlapping I2C address
if (dev->_matchI2CAddress(i2cAddress)) {
if (i2cAddress && dev->_I2CAddress==i2cAddress) {
DIAG(F("WARNING HAL Overlap. i2c Addr 0x%x ignored."),i2cAddress);
return false;
}
@ -302,9 +302,6 @@ bool IODevice::checkNoOverlap(VPIN firstPin, uint8_t nPins, uint8_t i2cAddress)
return true; // no overlaps... OK to go on with constructor
}
bool IODevice::_matchI2CAddress(uint8_t i2cAddress) {
return (i2cAddress && i2cAddress==_I2CAddress);
}
//==================================================================================================================
// Static data

View File

@ -228,9 +228,6 @@ protected:
// Pin number of interrupt pin for GPIO extender devices. The extender module will pull this
// pin low if an input changes state.
int16_t _gpioInterruptPin = -1;
// non-i2c hal drivers return false, i2c drivers override this in IO_GPIOBase
bool _matchI2CAddress(uint8_t i2cAddress);
// Method to check if pins will overlap before creating new device.
static bool checkNoOverlap(VPIN firstPin, uint8_t nPins=1, uint8_t i2cAddress=0);

View File

@ -76,7 +76,7 @@ public:
// Static create function provides alternative way to create object
static void create(VPIN vpin, int trigPin, int echoPin, uint16_t onThreshold, uint16_t offThreshold) {
if (checkNoOverlap(vpin) && checkNoOverlap(trigPin) && checkNoOverlap(echoPin))
if (checkNoOverlap(vpin))
new HCSR04(vpin, trigPin, echoPin, onThreshold, offThreshold);
}