Skip to content

Commit

Permalink
gpio: always propogate source location
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Dec 8, 2022
1 parent fc3dbc6 commit b9dcf3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions code/espurna/gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 5 additions & 3 deletions code/espurna/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());

0 comments on commit b9dcf3e

Please sign in to comment.