Shop OBEX P1 Docs P2 Docs Learn Events
Does __builtin_propeller_cogid() or cogid() work in flexprop for the P2? — Parallax Forums

Does __builtin_propeller_cogid() or cogid() work in flexprop for the P2?

A little background information, if I include BOTH of these header files:
simpletools.h
propeller.h

I get errors as it says one of the functions is being redefined.

From what I understand the __builtin_propeller_cogid() function is supposed to be in propeller.h

However it doesn't seem to work and/or I have problems with other functions when one or the other of those header files is commented out.

So.... I'm looking for a method where I can start a cog and have it get the cog number, which would be used later when deciding other functions to run or which I/O to use.

I searched the forum but couldn't find an answer. I was also wondering if there was a way to get the cog ID using assembly and placing it into a variable.

Any suggestions or resources where I can find the information I need?

Thank you!

Comments

  • evanhevanh Posts: 15,541

    Use _cogid(). The built-ins don't require any headers, afaik.

  • AribaAriba Posts: 2,686

    @MisterHemi said:
    ...
    I searched the forum but couldn't find an answer. I was also wondering if there was a way to get the cog ID using assembly and placing it into a variable.

    Any suggestions or resources where I can find the information I need?

    Thank you!

    In FlexProp IDE: Menu Help -> C Language
    Answers all your questions (from this thread) and the Inline PASM description even uses COGID in the example code.

    Andy

  • Thank you!

Sign In or Register to comment.