Page 1 of 1

defining parameter

Posted: Tue Nov 19, 2019 3:00 pm
by RyanMco
Hi Im trying to define parameter in specific file in my firmware like int x=0 in file stabilizer.c

but I want to use that parameter in another file like crtp_commander.c in the same firmware; how can I do that? I succeeded to define that int x=0 as static in stabilizer.c
but how can I use it in another file and it would be already defined ? thanks alot!!!

Re: defining parameter

Posted: Thu Nov 21, 2019 7:06 am
by arnaud
Parameters in the Crazyflie are variables that can be listed and accessed via the radio and, to some extend, an internal API. They are declared using macros: https://github.com/bitcraze/crazyflie-f ... #L531-L535 and there is functions to read them from within the firmware: https://github.com/bitcraze/crazyflie-f ... .h#L37-L45. There is no way yet to modify a parameter from within the Crazyflie using this API yet.

Though, the parameters and internal access to parameters are mostly intendend to be used by an app-layer program: to implement your own custom code beside the Crazyflie. In your case since you want to modify the core of the Crazyflie, I would suggest you implement regular functions or, for quick and dirty test, use external variables to communicate between modules.