jperkin / node-rpio

Raspberry Pi GPIO library for node.js
857 stars 123 forks source link

i2cWriteReadRestart error. Binding.i2c_write_read_rs is undefined #121

Closed mlongo4290 closed 4 years ago

mlongo4290 commented 4 years ago

I need to use i2cWriteReadRestart on a Raspberry PI 4. Despite being defined in node the value of binding.i2c_write_read_rs is undefined.

This is the result of the mock test

# Subtest: i2c write read restart
    not ok 1 - bindfunc is not a function
      ---
      stack: |
        bindcall4 (/home/pi/node-rpio/lib/rpio.js:128:9)
        rpio.i2cWriteReadRestart (/home/pi/node-rpio/lib/rpio.js:738:9)
        Test.<anonymous> (mock_i2c.js:29:7)
      at:
        line: 128
        column: 9
        file: /home/pi/node-rpio/lib/rpio.js
        function: bindcall4
      type: TypeError
      tapCaught: testFunctionThrow
      test: i2c write read restart
      source: |

            return bindfunc(arg1, arg2, arg3, arg4);
        --------^
        }
      ...

    1..1
    # failed 1 test
not ok 1 - i2c write read restart # time=60.92ms

1..1
# failed 1 test
# time=72.949ms

And a screenshot showing only the i2c functions available at runtime Screenshot

mlongo4290 commented 4 years ago

Added pull request #122 to solve the issue