Wire.end() has been added to the Wire library

Information on the latest releases
Post Reply
User avatar
RogerClark
Posts: 7496
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Wire.end() has been added to the Wire library

Post by RogerClark » Mon Jun 12, 2017 7:17 am

Several people noticed that the end() method was missing from the Wire class, so I've added this function to both the software and hardware I2C classes

FYI.
Looking in the AVR code, Wire.end() seems to disable the I2C device. So in the software (bit-banged) version, I've simply set the 2 GPIO pins to INPUT mode.
The hardware I2C class has a disable function, (which is called in the class destructor), so I've copied the code from the destructor


Note.

I'm hoping the users who noticed this omission can confirm that this fixes their problems, but I have not had any feedback yet, so this code is still possibly subject to change

peekay123
Posts: 18
Joined: Tue Nov 08, 2016 8:39 pm

Re: Wire.end() has been added to the Wire library

Post by peekay123 » Mon Jun 12, 2017 2:47 pm

Roger, the new Wire.end() function definition only has a single colon in HardWire.cpp and is causing a compile error. :D

User avatar
RogerClark
Posts: 7496
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Wire.end() has been added to the Wire library

Post by RogerClark » Mon Jun 12, 2017 9:51 pm

peekay123 wrote:Roger, the new Wire.end() function definition only has a single colon in HardWire.cpp and is causing a compile error. :D
yikes..

Sorry about that. I though I had test compiled it using the Hardware scanner example, so I dont know why I didnt see that error.

I will fix asap ( in an hour ) and push an update

User avatar
RogerClark
Posts: 7496
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Wire.end() has been added to the Wire library

Post by RogerClark » Mon Jun 12, 2017 10:34 pm

I fixed the typo and have pushed the commit.

Please can you confirm its now working for you

peekay123
Posts: 18
Joined: Tue Nov 08, 2016 8:39 pm

Re: Wire.end() has been added to the Wire library

Post by peekay123 » Wed Jun 14, 2017 4:20 pm

All good!

User avatar
RogerClark
Posts: 7496
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Wire.end() has been added to the Wire library

Post by RogerClark » Wed Jun 14, 2017 10:00 pm

excellent...


BTW. Are you using Hardware or SW I2C?

peekay123
Posts: 18
Joined: Tue Nov 08, 2016 8:39 pm

Re: Wire.end() has been added to the Wire library

Post by peekay123 » Thu Jun 15, 2017 1:06 pm

I've tried both HardWire and Wire and both work well. However, in my project, I am using HardWire. :D

User avatar
RogerClark
Posts: 7496
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Wire.end() has been added to the Wire library

Post by RogerClark » Thu Jun 15, 2017 9:14 pm

excellent.

I will mark that issue as fixed ;-)

Post Reply