defining parameter

Firmware/software/electronics/mechanics
Post Reply
RyanMco
Expert
Posts: 159
Joined: Tue Apr 09, 2019 6:15 am

defining parameter

Post 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!!!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: defining parameter

Post 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.
Post Reply