Shop OBEX P1 Docs P2 Docs Learn Events
[FlexSpin] Filling structs from function calls — Parallax Forums

[FlexSpin] Filling structs from function calls

Hey @ersmith

Does the attached look like it could be a bug? I'm trying to populate a structure using the return from a function. I'm not in the habit of returning instances of structures, but the one I've defined is the same overall size as a long, so I though it may work. The symptom I'm seeing is it doesn't seem to fully write (only the last byte seems to make it in, shown by the debug hexdump). Weirdly, if I add a second debug statement to the function that's populating the structure, it works correctly. NuCode also works correctly here (without the need for uncommenting that second hexdump).

As an alternative, returning a pointer to the same type of structure instead works better with one call, although if I make two separate calls to two different structs, only the second one seems to get written, so it seems like something isn't quite right there, either.

Thanks

Sign In or Register to comment.