Newbie question : How to use PC_debug in multiple object
steamboy
Posts: 2
Hello,
I am trying to put debug statement in my code using PC_debug. I am defining the Object PC_debug in my top level object with "debug : "PC_debug"".
So I am able of course to do debug statement in this object. But what is the best way to do debug statement in child object using the same PC_debug object.
How a child object could see an upper object ?
Thanks for your help,
Best Regard
Christophe
I am trying to put debug statement in my code using PC_debug. I am defining the Object PC_debug in my top level object with "debug : "PC_debug"".
So I am able of course to do debug statement in this object. But what is the best way to do debug statement in child object using the same PC_debug object.
How a child object could see an upper object ?
Thanks for your help,
Best Regard
Christophe
Comments
It is messy to use an object like PC_debug in more than one object. It can be done. Easiest if you just want to use it in the top level and one lower level is to define it in the lower level and provide some PUB routines to export the PC_debug functions to the higher level. In the lower level object you'd have:
and so on for any of the debug routines that you need at the higher level. At the higher level, if you had 'OBJ low : "lower_level"', you'd call "low.deb_start(9600)" or something similar, then "low.deb_dec(5500)" and "low.deb_newline" or whatever you need.
Best regards,
christophe.