Should I2C use Hardware by default

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

Should I2C use Hardware by default

Post by RogerClark » Mon Jul 31, 2017 3:59 am

In issue

https://github.com/rogerclarkmelbourne/ ... issues/301

The question of usage of Hardware vs Software I2C was raised

I'm not sure if we can perhaps change to Hardware I2C as the default, now that its working

feurig
Posts: 1
Joined: Wed Apr 29, 2015 6:07 pm

Re: Should I2C use Hardware by default

Post by feurig » Mon Jul 31, 2017 5:40 am

+1

It seems ridiculous to bitbang i2c when there is reasonable hardware to support it and working software.

Just my 2 pfennigs ..

stevestrong
Posts: 1818
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Should I2C use Hardware by default

Post by stevestrong » Mon Jul 31, 2017 8:31 am

+1
I agree with @feurig.

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

Re: Should I2C use Hardware by default

Post by RogerClark » Mon Jul 31, 2017 9:46 am

I should have said, that I think its time to move to HardWire

So unless someone disagrees I think I'll have a go at changing to HardWire and test with a BME280 that I have in my box of spares.

victor_pv
Posts: 1743
Joined: Mon Apr 27, 2015 12:12 pm

Re: Should I2C use Hardware by default

Post by victor_pv » Mon Jul 31, 2017 12:51 pm

+1 on using it.

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

Re: Should I2C use Hardware by default

Post by RogerClark » Mon Jul 31, 2017 9:28 pm

OK.

Sounds like another "little" job for any spare time I can scrape together

PS. Changing the code is the easy bit.
It's testing that takes the time ;-)

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

Re: Should I2C use Hardware by default

Post by RogerClark » Tue Aug 01, 2017 6:58 am

OK.

I've changed this over in this commit

https://github.com/rogerclarkmelbourne/ ... 8eda8254e6

I've tested with a STM time of flight device (VL53L0X ) which is I2C and it worked fine, to read data from this device and also the I2C scanner works

I've renamed HardWire files to Wire, and the old bit banged files to SoftWire

I've also updated the examples so there is an example of Wire, SoftWire and HardWire (Hardwire is now the same as Wire)

Post Reply