diff options
Diffstat (limited to '')
| -rw-r--r-- | src/peripherals/gpio.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/peripherals/gpio.ts b/src/peripherals/gpio.ts index 6d1dae8..07667d9 100644 --- a/src/peripherals/gpio.ts +++ b/src/peripherals/gpio.ts @@ -229,11 +229,11 @@ export class AVRIOPort { this.updatePinRegister(ddrMask); return true; }; - cpu.writeHooks[portConfig.PIN] = (value: u8) => { + cpu.writeHooks[portConfig.PIN] = (value: u8, oldValue, addr, mask) => { // Writing to 1 PIN toggles PORT bits const oldPortValue = cpu.data[portConfig.PORT]; const ddrMask = cpu.data[portConfig.DDR]; - const portValue = oldPortValue ^ value; + const portValue = oldPortValue ^ (value & mask); cpu.data[portConfig.PORT] = portValue; this.writeGpio(portValue, ddrMask); this.updatePinRegister(ddrMask); |
