Shop OBEX P1 Docs P2 Docs Learn Events
Cons&Vars in other Objects — Parallax Forums

Cons&Vars in other Objects

bambinobambino Posts: 789
edited 2007-05-29 17:24 in Propeller 1
Mike,
I finally got around to the I2C routine in the Object exchange and noticed a nifty trick you did with the calls to other objects.
obj
   otherObject : object
pub Main
   otherObject.someRoutine(#someConstant)
 

Is there some way to access Vars in the same way where it's undeclared in the calling Object?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-25 15:05
    No. Only constants and public methods are accessible from other objects. The constant reference has to be "otherObject#someConstant".
  • bambinobambino Posts: 789
    edited 2007-05-25 15:15
    Thanks Mike,

    No biggy, I just think its neat how things new to me about this chip come up all the time.

    Another Q about that simple driver(not FemtoBasic). Is pageread and write the only accessable funtions for read & write or can bytes, words, and longs be used?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-25 15:32
    bambino,
    The Basic I2C Driver includes public methods for read & write of bytes, words, and longs. These all call readpage and writepage. Take a look.
  • bambinobambino Posts: 789
    edited 2007-05-25 15:58
    Thanks Again,

    It's not fresh on my mind what we are looking at but I did get the routines at the top that are commented out to work. The other methods will take a while more. But thanks for the object, I have always worked with SPI and this is my first I2C. You have made it a little less intimadating!
  • M. K. BorriM. K. Borri Posts: 279
    edited 2007-05-26 09:46
    i used a HUGE hack, but here ya go... I put a dat block in a library, and a bunch of constants that refer to the offsets in that dat block (4 bytes apart), then have everything call that library. Ugly as sin, but it works and it works efficiently.

    See my sig to download it [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://forums.parallax.com/showthread.php?p=650217

    meow, i have my own topic now? (sorta)
  • bambinobambino Posts: 789
    edited 2007-05-29 17:24
    Sorry it took so long getting back,

    M K,
    Thanks, I'll take a look!
Sign In or Register to comment.