Go Down

Topic: Arduino and 1-wire (Read 17 times) previous topic - next topic


Oh OK. After I got done putting in all the rubbish to make the C++ and C symbols work together I did feel it would be better as a class. I'm away from that hardware until Tuesday, I'll redo it as C++ then.



Having things like:

Code: [Select]
OneWire.write(value, power)

Would make the code that much easier to use and more consistent with the other libraries.


All packaged in C++ form. Well, not the keywords.txt file. I'm not sure what that is, though I guess it has something to do with the color coding of the build in editor.

http://www.federated.com/~jim/onewire/ contains the library and a sample program. Feel free to vacuum it up into anything you like.

This library is general 1-wire. It might be nice to derive a DS18S20 class from this that knows about temperature to handle the conversions, or that might start making too much object code. Maybe I'm being too sensitive to code bloat, but it seems that higher level libraries will end up containing a lot of unused functions for any given application. e.g. I won't use the alarm threshold registers in my application but I'd end up with functions for them linked into my code. I had enough worry about that in just the generic functions that I ended up with a couple nasty preprocessor symbols to omit some of the larger functions that people might not need.


Very nice.  I may try to write up a bit of documentation for it in the playground, unless someone else decides to do it first.


I will make the keywords.txt then. That seems to be the easiest part.  :)

Go Up