gpio: always propogate source location

This commit is contained in:
Maxim Prokhorov
2022-12-08 13:08:11 +03:00
parent fc3dbc6b2b
commit b9dcf3e048
2 changed files with 11 additions and 7 deletions

View File

@@ -814,18 +814,20 @@ GpioBase* gpioBase(GpioType type) {
return ptr;
}
BasePinPtr gpioRegister(GpioBase& base, unsigned char gpio) {
BasePinPtr gpioRegister(GpioBase& base, unsigned char gpio,
espurna::SourceLocation source_location)
{
BasePinPtr result;
if (gpioLock(base, gpio)) {
if (gpioLock(base, gpio, source_location)) {
result = base.pin(gpio);
}
return result;
}
BasePinPtr gpioRegister(unsigned char gpio) {
return gpioRegister(hardwareGpio(), gpio);
BasePinPtr gpioRegister(unsigned char gpio, espurna::SourceLocation source_location) {
return gpioRegister(hardwareGpio(), gpio, source_location);
}
void gpioSetup() {

View File

@@ -55,9 +55,6 @@ GpioBase* gpioBase(GpioType);
GpioBase& hardwareGpio();
void hardwareGpioIgnore(unsigned char gpio);
BasePinPtr gpioRegister(GpioBase& base, unsigned char gpio);
BasePinPtr gpioRegister(unsigned char gpio);
void gpioLockOrigin(espurna::gpio::Origin);
void gpioSetup();
@@ -131,3 +128,8 @@ inline bool gpioLocked(const GpioBase& base, unsigned char gpio) {
inline bool gpioLocked(unsigned char gpio) {
return gpioLocked(hardwareGpio(), gpio);
}
BasePinPtr gpioRegister(GpioBase& base, unsigned char gpio,
espurna::SourceLocation source_location = espurna::make_source_location());
BasePinPtr gpioRegister(unsigned char gpio,
espurna::SourceLocation source_location = espurna::make_source_location());