diff --git a/lib/index.js b/lib/index.js index 82fb50b..9a352eb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -428,7 +428,7 @@ class Pin extends Emitter { if (state.isPwm || state.isServo) { if (state.index === 15) { - state.pin._port.sock.write(new Buffer([Port.CMD.ANALOG_WRITE, value >> 8, value & 0xff])); + state.pin.port.sock.write(new Buffer([Port.CMD.ANALOG_WRITE, value >> 8, value & 0xff])); } else { state.pin.pwmDutyCycle(value); } @@ -487,7 +487,7 @@ class Pin extends Emitter { if (state.isAnalogInput) { adcReadRequests.push({ command: new Buffer([Port.CMD.ANALOG_READ, index]), - port: state.pin._port, + port: state.pin.port, size, callback, }); @@ -504,9 +504,9 @@ class Pin extends Emitter { } const poll = _ => { - state.pin._port.cork(); - state.pin._port.sock.write(state.commands.read); - state.pin._port.enqueue({ + state.pin.port.cork(); + state.pin.port.sock.write(state.commands.read); + state.pin.port.enqueue({ size, callback(error, data) { /* istanbul ignore if */ @@ -524,7 +524,7 @@ class Pin extends Emitter { data = null; }, }); - state.pin._port.uncork(); + state.pin.port.uncork(); }; poll();