0
Offline
Full Member
Karma: 0
Posts: 203
|
 |
« Reply #30 on: January 14, 2007, 05:01:40 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
|
 |
« Reply #31 on: January 15, 2007, 02:49:13 am » |
Awesome. Having things like: OneWire(pin); OneWire.read(); OneWire.write(value, power) Would make the code that much easier to use and more consistent with the other libraries.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 203
|
 |
« Reply #32 on: January 16, 2007, 09:47:41 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
|
 |
« Reply #33 on: January 17, 2007, 03:24:53 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 183
|
 |
« Reply #34 on: January 17, 2007, 06:45:18 am » |
I will make the keywords.txt then. That seems to be the easiest part. 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 81
everywhen
|
 |
« Reply #35 on: January 17, 2007, 04:05:19 pm » |
I made a rough outline at http://www.arduino.cc/playground/Learning/OneWireWhen I get some time later today, I'll go through and edit it up.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 183
|
 |
« Reply #36 on: January 18, 2007, 11:43:41 am » |
So, the easiest jobis done too, although I am not sure if I got it right. I thought I read something about the keywords.txt file, but I can't find it anymore. ####################################### # Syntax Coloring Map For OneWire #######################################
####################################### # Datatypes (KEYWORD1) #######################################
OneWire KEYWORD1
####################################### # Methods and Functions (KEYWORD2) #######################################
reset KEYWORD2 write_bit KEYWORD2 read_bit KEYWORD2 write KEYWORD2 read KEYWORD2 select KEYWORD2 depower KEYWORD2 reset_search KEYWORD2 search KEYWORD2 crc8 KEYWORD2 crc16 KEYWORD2
####################################### # Instances (KEYWORD2) #######################################
####################################### # Constants (LITERAL1) #######################################
[edit]changed the keywords.txt[/edit]
|
|
|
|
« Last Edit: January 19, 2007, 09:26:00 am by bigengineer »
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
|
 |
« Reply #37 on: January 19, 2007, 03:43:48 am » |
You can check out the keywords.txt of the existing libraries (in lib/targets/libraries). It looks good, except that OneWire should be in the datatypes section and a KEYWORD1. Now we just need to zip it all and upload it somewhere (the playground?).
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 183
|
 |
« Reply #38 on: January 19, 2007, 09:27:39 am » |
You can check out the keywords.txt of the existing libraries (in lib/targets/libraries). It looks good, except that OneWire should be in the datatypes section and a KEYWORD1. Now we just need to zip it all and upload it somewhere (the playground?). I made this after looking at an example. Only the OneWire wasn't clear to me. I have changed the file, so you can just copy/paste it.
|
|
|
|
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 8
Posts: 3532
|
 |
« Reply #39 on: January 19, 2007, 09:58:18 am » |
Cool, thanks.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 2
Arduino rocks
|
 |
« Reply #40 on: July 06, 2007, 03:08:22 pm » |
Has anybody gotten this working with the 008 environment? I can make it compile by changing digital_pin_to_port to digital_pin_to_port_PGM and such, but I'm not getting valid readings from the DS18S20P I'm testing it with.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 2
Arduino rocks
|
 |
« Reply #41 on: July 06, 2007, 07:42:04 pm » |
Has anybody gotten this working with the 008 environment? Jim Studt was kind enough to email me with details of how to get the OneWire library working with arduino-0008. I've posted an updated version of the library to http://www.elsewhere.org/onewire/Thanks, Jim!
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #42 on: July 12, 2007, 07:19:08 am » |
Don't know if you need more code sample for One Wire, but the project OWW is open source and addresses a lot of One Wire devices : http://oww.sourceforge.net
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 6
Arduino rocks
|
 |
« Reply #43 on: September 05, 2007, 03:20:30 pm » |
The OneWire library working fine with Arduino-0009. I'm reading from two DS18S20 using parasite power.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 28
architecture | media | computing
|
 |
« Reply #44 on: September 09, 2007, 06:54:37 pm » |
EDIT: nevermind .... figured it out :o
|
|
|
|
« Last Edit: September 09, 2007, 08:39:01 pm by daidalos »
|
Logged
|
|
|
|
|
|