Go Down

Topic: I2C pullup resistors - 1 master with 6 Slave (Read 4792 times) previous topic - next topic

outofoptions

#15
Jan 15, 2016, 10:57 pm Last Edit: Jan 15, 2016, 11:08 pm by outofoptions
If it is undocumented then for all intents and purposes it isn't there.
Some people would say if it is in the code it is documented.  Header files are human readable.  Maybe poorly advertised would be a better description?

Though, I don't see that functin on the github version:
https://github.com/Seeed-Studio/LinkIt-ONE-IDE/blob/master/hardware/arduino/mtk/libraries

/Wire/Wire.h

    TwoWireStatus status;

    // TWI clock frequency
    static const uint32_t TWI_CLOCK = 100000;

    // Timeouts (
    static const uint32_t RECV_TIMEOUT = 100000;
    static const uint32_t XMIT_TIMEOUT = 100000;

Grumpy_Mike

#16
Jan 15, 2016, 11:41 pm Last Edit: Jan 15, 2016, 11:42 pm by Grumpy_Mike
Quote
If I translate correctly your words  in French (I can mistake) : this function is not documented so do not use it
No you do not translate my words correctly.

If it is not documented, then nobody can use it because nobody knows about it. It is a secrete.

Quote
Some people would say if it is in the code it is documented.
Just because some people say something does not make it true. Some people say we never went to the Moon but that doesn't make the proposal true.

outofoptions

No you do not translate my words correctly.

If it is not documented, then nobody can use it because nobody knows about it. It is a secrete.
Just because some people say something does not make it true. Some people say we never went to the Moon but that doesn't make the proposal true.
The code is a document though.  It is human readable.  The point is what you consider documented.    Again, I'm not sure where he gets his example from because the header file I pulled up doesn't seem to have that function.  Probably a case of someone having modified or forked the 'official' IF there is an official header file?

OldSteve

#18
Jan 16, 2016, 04:00 am Last Edit: Jan 16, 2016, 04:07 am by OldSteve
Again, I'm not sure where he gets his example from because the header file I pulled up doesn't seem to have that function.
I have the version of "Wire" included with the IDE V1.6.5, and it has the 'setClock()' function declared in the "Wire.h" header, (and defined in the cpp file, of course). It's not just 'forked' versions that have it.
It doesn't have a version number as such, but it was written in 2006, last modified 2012.

Code: [Select]
void TwoWire::setClock(uint32_t frequency)
{
    TWBR = ((F_CPU / frequency) - 16) / 2;
}


The one on GitHub that you linked to is for the Due only, not the standard distribution version for UNO, Mega etc:-
Quote
* TwoWire.h - TWI/I2C library for Arduino Due
 * Copyright (c) 2011 Cristian Maglie <c.maglie@bug.st>.
 * All rights reserved.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

outofoptions

#19
Jan 16, 2016, 04:30 am Last Edit: Jan 16, 2016, 04:50 am by outofoptions
Well, this is bizarre.  I'm using the package for Debian 'stable'.  I'm not even sure what version I'm using as they seem to have their own thing going on.  Under version they have 2:1.0.5+dfcg2.-4  whatever that means. (I've been wondering if I should just download the tarball because I've thought about getting a DUE and this doesn't have 'board manager' in the tools)  My .h and .cpp have the same dates as yours but nothing about the set clock.

Does your system have the a file like this?

/usr/share/doc/arduino-core/reference/Wire.html

I suppose we could consider that the official documentation.  Still, there is evidence that maybe the file got added to without being documented at some point.  I doubt the Debian packager simply stripped stuff out of the files.

Just looked.  If you check out this page the wire library was changed as recently as ARDUINO 1.6.6 - 2015.11.03.

https://www.arduino.cc/en/Main/ReleaseNotes

and

ARDUINO 1.5.7 BETA - 2014.07.07
 Added Wire.setClock(..) method (Kristian Sloth Lauszus)

I guess I'll definitely downloading the tarball cuz I'm well behind based on that.

OldSteve

#20
Jan 16, 2016, 04:54 am Last Edit: Jan 16, 2016, 04:57 am by OldSteve
Does your system have the a file like this?

/usr/share/doc/arduino-core/reference/Wire.html

I suppose we could consider that the official documentation.  Still, there is evidence that maybe the file got added to without being documented at some point.  I doubt the Debian packager simply stripped stuff out of the files.
Yes, that documentation is in my install. Unfortunately, documentation is always very limited, and never actually references all of the public functions contained within a library. Pity, because it tends to limit usage.
I like to read the actual source files of any library that I use, to get a better understanding of what's available and how everything works, even if I do just stick to the 'documented' stuff.

For instance, it's handy to know that you can disable the I2C internal pullups in "twi.c", but it's not documented.

Edit: I just noticed that you added some more as I was typing. No doubt my V1.6.5 libraries are a little out-of-date, but I'll continue to use them until I update the actual IDE. (I'm putting that off for now, because I currently have no problems and don't want to introduce any. :) )
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

outofoptions

Sounds like the code base, especially the libraries and documentation, need a proper version control system put in place.

OldSteve

Sounds like the code base, especially the libraries and documentation, need a proper version control system put in place.
Yep, or at the very least, a version/revision number at the top of the header and cpp files. As things stand, we can never even be sure that the 'modified' dates are accurate, and many only state a year, not day and month.
Even in my own programs, intended for my eyes only, I use the full date and sometimes a version number.
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Go Up