Skip to content

Commit

Permalink
Merge pull request #9559 from mluessi/ml_fix_pionio_inverted
Browse files Browse the repository at this point in the history
PINIO: Fix inverted pin handling
  • Loading branch information
DzikuVx authored Mar 22, 2024
2 parents 6ca2878 + f4ab90d commit 2b1df9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/main/drivers/pinio.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@ void pinioInit(void)
}
}

void pinioSet(int index, bool on)
void pinioSet(int index, bool newState)
{
const bool newState = on ^ pinioRuntime[index].inverted;

if (!pinioRuntime[index].io) {
return;
}

if (newState != pinioRuntime[index].state) {
IOWrite(pinioRuntime[index].io, newState);
IOWrite(pinioRuntime[index].io, newState ^ pinioRuntime[index].inverted);
pinioRuntime[index].state = newState;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/drivers/pinio.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ extern const pinioHardware_t pinioHardware[];
extern const int pinioHardwareCount;

void pinioInit(void);
void pinioSet(int index, bool on);
void pinioSet(int index, bool newState);

0 comments on commit 2b1df9e

Please sign in to comment.