willhey / mcp23017chip

Node-red mcp23017chip
MIT License
6 stars 7 forks source link

Feature requests (Choice of the I2C Device in the parameters) #1

Open arsiesis opened 7 years ago

arsiesis commented 7 years ago

Hello,

The Raspberry PI uses an special device name to connect to the I2C controller. Depending on the Raspberry PI version it can be one of the below values :

https://xdevs.com/article/adding-i2c0-port-raspberry-pi-b-rev-20/

We would therefore be able to connect 16x mcp23017 to a raspberry

Could you add this choice in the configuration ? Please...

artyrn commented 5 years ago

`

` добавил в файле mcp23017chip.html

` function mcp23017chipNode(n) { RED.nodes.createNode(this,n); this.addr = parseInt(n.addr, 16); this.interval = n.interval; this.dev = 0x01; this.dev = parseInt(n.dev, 16); //добавил чтение адреса порта i2c this.isInputs = 0x0000; this.pullUps = 0x0000; this.inverts = 0x0000; this.ids = new Array(16); this.lastRead = 0x0000; this.lastWrite = 0x0000;

            this.i2c1 = i2cBus.openSync(this.dev);

` добавил в файле mcp23017chip.js

при конфигурации появится запрос номера i2c, вводить 0 или 1 открываться соответственно будет /dev/i2c-0 или /dev/i2c-1