Hi Ada and all,
I have several Neokeys 1x4 and using them with a Teensy which has several i2C ports
As the default i2c pins are already used, how can I define other pins to be used by the seesaw library ?
Can Adafruit_NeoKey_1x4 neokey OR neokey.begin(0x30) accepts some pins pararameters ?
or should (and where?) I modify the lib ?
Thanks a lot,
Fab
Neokey 1x4 seesaw lib with different I2C pins ?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- fff2049
- Posts: 3
- Joined: Sat Dec 25, 2021 6:42 am
- dastels
- Posts: 15653
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Neokey 1x4 seesaw lib with different I2C pins ?
Although the Adafruit_NeoKey_1x4 class extends Adafruit_seesaw, it does support the same constructor call. I.e. you can't pass in the TwoWire (i.e. I2C buss) to use and use the base class to use it. You would have to modify (ideally add) a constructor that does so. See https://github.com/adafruit/Adafruit_Se ... seesaw.cpp (and .h) and https://github.com/adafruit/Adafruit_Se ... ey_1x4.cpp (and .h).
Dave
Dave
- fff2049
- Posts: 3
- Joined: Sat Dec 25, 2021 6:42 am
Re: Neokey 1x4 seesaw lib with different I2C pins ?
Hi Dave,
Thanks for your reply
... unfortunatelly i did (or at least tried) to do my homework before posting my initial question ... and already look at these files in the lib
And because I see not obvious pin definition to change, this is out of reach of my poor level
The good news is that, as I do not need that lib nor that port for anything else than several NeoKeys, It probably can be a messy/simple change
Any precise location(s) in these files where I should set SDApin=17 & SCLpin=16 ?
Thanks A LOT for your support
Fab
Thanks for your reply
... unfortunatelly i did (or at least tried) to do my homework before posting my initial question ... and already look at these files in the lib
And because I see not obvious pin definition to change, this is out of reach of my poor level
The good news is that, as I do not need that lib nor that port for anything else than several NeoKeys, It probably can be a messy/simple change
Any precise location(s) in these files where I should set SDApin=17 & SCLpin=16 ?
Thanks A LOT for your support
Fab
- dastels
- Posts: 15653
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Neokey 1x4 seesaw lib with different I2C pins ?
The library, itself, doesn't worry about pins. It uses a TwoWire object that is set up outside the library and passed to the seesaw constructor. If it isn't, then it defaults to the global Wire object. One approach is to expose the ability to pass a TwoWire object to the NeoKey constructor, or change the default behavior when a TwoWire object isn't provided. Another option is to set the _i2cbus instance variable in the Adafruit_NeoKey_1x4 constructor to a TwoWire instance created with the appropriate pins.
Dave
Dave
- fff2049
- Posts: 3
- Joined: Sat Dec 25, 2021 6:42 am
Re: Neokey 1x4 seesaw lib with different I2C pins ?
Thanks Dave to point in the right direction
To all other noobs like me, it did work by "simply" (only once the help of Dave)
replacing "&Wire" by "&Wire1" in Adafruit_seesaw.cpp
Wire1 being defined in the Teensy as the 2nd I2C port ("Wire" being the default one)
Again, not a very clean solution but works
BR,
Fab
To all other noobs like me, it did work by "simply" (only once the help of Dave)
replacing "&Wire" by "&Wire1" in Adafruit_seesaw.cpp
Wire1 being defined in the Teensy as the 2nd I2C port ("Wire" being the default one)
Again, not a very clean solution but works
BR,
Fab
- dastels
- Posts: 15653
- Joined: Tue Oct 20, 2015 3:22 pm
Re: Neokey 1x4 seesaw lib with different I2C pins ?
Very good! Glad it was that simple in the end.
Dave
Dave
- adafruit2
- Posts: 22144
- Joined: Fri Mar 11, 2005 7:36 pm
Re: Neokey 1x4 seesaw lib with different I2C pins ?
oh thats annoying - i thinkwe just forgot to add it. an issue is made here
https://github.com/adafruit/Adafruit_Seesaw/issues/61
we'll be doing some more work on this library in the next few weeks and can update it then
https://github.com/adafruit/Adafruit_Seesaw/issues/61
we'll be doing some more work on this library in the next few weeks and can update it then
Please be positive and constructive with your questions and comments.