From b9dcf3e04836f12cd0a1c13b0cdfe178f89f2bb8 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Thu, 8 Dec 2022 13:08:11 +0300 Subject: [PATCH] gpio: always propogate source location --- code/espurna/gpio.cpp | 10 ++++++---- code/espurna/gpio.h | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/code/espurna/gpio.cpp b/code/espurna/gpio.cpp index acdb0a11..a4f6387f 100644 --- a/code/espurna/gpio.cpp +++ b/code/espurna/gpio.cpp @@ -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() { diff --git a/code/espurna/gpio.h b/code/espurna/gpio.h index 2bc09d05..213704bc 100644 --- a/code/espurna/gpio.h +++ b/code/espurna/gpio.h @@ -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());