From cb71d87c2831b842e72bb6152ac5d8144b9bbd03 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Wed, 7 Oct 2020 12:42:23 +0300 Subject: fix(gpio): Changing pinMode from `INPUT` to `INPUT_PULLUP` doesn't trigger listeners close #62 --- src/peripherals/gpio.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/peripherals/gpio.ts') diff --git a/src/peripherals/gpio.ts b/src/peripherals/gpio.ts index e0861d7..4130c82 100644 --- a/src/peripherals/gpio.ts +++ b/src/peripherals/gpio.ts @@ -204,7 +204,7 @@ export class AVRIOPort { } private writeGpio(value: u8, ddr: u8) { - const newValue = ((value & this.overrideMask) | this.overrideValue) & ddr; + const newValue = (((value & this.overrideMask) | this.overrideValue) & ddr) | (value & ~ddr); const prevValue = this.lastValue; if (newValue !== prevValue || ddr !== this.lastDdr) { this.lastValue = newValue; -- cgit v1.2.3