diff options
Diffstat (limited to 'src/peripherals/gpio.ts')
| -rw-r--r-- | src/peripherals/gpio.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/peripherals/gpio.ts b/src/peripherals/gpio.ts index a667967..35030b8 100644 --- a/src/peripherals/gpio.ts +++ b/src/peripherals/gpio.ts @@ -94,6 +94,10 @@ export class AVRIOPort { private listeners: GPIOListener[] = []; constructor(private cpu: CPU, private portConfig: AVRPortConfig) { + cpu.writeHooks[portConfig.DDR] = (value, oldValue) => { + const portValue = cpu.data[portConfig.PORT]; + this.writeGpio(value & portValue, oldValue & oldValue); + }; cpu.writeHooks[portConfig.PORT] = (value: u8, oldValue: u8) => { const ddrMask = cpu.data[portConfig.DDR]; cpu.data[portConfig.PORT] = value; |
