I'm still confused about object vs cog
henkvbeek
Posts: 11
I'm still confused about obects and cogs.
Suppose, I have a SPIN-object, a full duplex serial interface.
I would like this object to run in one separate cog, totally undependent of my main program.
It should be nice to put this into one , I mean really one, object.
All public methods, config, tx, rx, rxcheck and str, should be accessable even by the main program and by all other objects.
These other objects are running or in the same cog as the main-program or in other cogs.
I can't find how I declare this.
I may start a new cog with an argument of a SPIN-method, not with an argument of the whole object.
Please, enlight me
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
What God wants, God gets . . .
Suppose, I have a SPIN-object, a full duplex serial interface.
I would like this object to run in one separate cog, totally undependent of my main program.
It should be nice to put this into one , I mean really one, object.
All public methods, config, tx, rx, rxcheck and str, should be accessable even by the main program and by all other objects.
These other objects are running or in the same cog as the main-program or in other cogs.
I can't find how I declare this.
I may start a new cog with an argument of a SPIN-method, not with an argument of the whole object.
Please, enlight me
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
What God wants, God gets . . .
Comments
Oliver
I would like the methods of object Fullduplex start, str, rxCheck, rx, tx and stop all running in one separate Cog.
How will I implement this ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
What God wants, God gets . . .
With the Fullduplex object, you're already doing the bulk of the work in a cog started by Uart.start. The Uart routines that you see (rxCheck, rx, tx, stop, str) are just interfaces to this separate cog. They're fast and short and should run in your main cog although they could be called from some other cog should your application need that (like for debugging a separate cog that interfaces to the PING sensor).