Object Questions
MasterC
Posts: 39
So, I'm·just jumping into using I2C devices, and I'm·looking at some of the objects in the object exchange.· My real question below is really applicable to objects in general, but here's a side question about the I2C drivers:
My Side Question: ·I've taken a look at the Basic_I2C_Driver v1.1 by Mike Green, the i2cDemoApp v2.1 by James Burrows (based on Mike Green's), and the I2C SPIN Object v2.0 by Dave Custer (based on James Burrows' which is based on Mike Green's).· My question is, which would be the best starting point to use as a full-featured and generic I2C object?· I was·leaning towards the last one (by Dave Custer), but I haven't seen·that one·come up much when searching the forums.
My Real Question:
OK, now for my real question.· In browsing the i2cDemoApp, I noticed that it includes as on object the basic_i2c_driver.· However, it also includes several other objects for particular i2c devices, each of which also includes the basic_i2c_driver object.· So, does that mean the same code is redundantly included like 8 separate times?· Or is the compiler (or whatever you call it) smart enough to only include one copy of the object that is reference multiple times?
Thanks for the help!
My Side Question: ·I've taken a look at the Basic_I2C_Driver v1.1 by Mike Green, the i2cDemoApp v2.1 by James Burrows (based on Mike Green's), and the I2C SPIN Object v2.0 by Dave Custer (based on James Burrows' which is based on Mike Green's).· My question is, which would be the best starting point to use as a full-featured and generic I2C object?· I was·leaning towards the last one (by Dave Custer), but I haven't seen·that one·come up much when searching the forums.
My Real Question:
OK, now for my real question.· In browsing the i2cDemoApp, I noticed that it includes as on object the basic_i2c_driver.· However, it also includes several other objects for particular i2c devices, each of which also includes the basic_i2c_driver object.· So, does that mean the same code is redundantly included like 8 separate times?· Or is the compiler (or whatever you call it) smart enough to only include one copy of the object that is reference multiple times?
Thanks for the help!
Comments
2) There are now several other I2C objects including one in assembly that's used internally in FemtoBasic (sdspiFemto.spin), but is usable by itself. There's some I2C support in the BS2 Functions object as well.
The answer to your question about which object to start with depends on what you want to do with it and whether the demo program included provides support for the devices you want to start with. If you're going to just use I2C memories, the Basic_I2C_Driver is fine by itself. James' and Dave's objects include support for various other I2C devices.
Anyway, cool.· Thanks!