Frans-Willem / TSDZ2-Clean-EBike

Flexible OpenSource firmware for TongSheng TSDZ2 mid drive ebike motor and pheriperals
GNU General Public License v3.0
3 stars 0 forks source link

[STRUCTURE] Global variables in a single file #8

Open benno90 opened 4 years ago

benno90 commented 4 years ago

I suggest to collect all global variables in a single file, for example global.cpp, with the corresponding extern definitions in global.h.

definition of a variable in global.cpp: uint8_t ui8_g_global_variable = 0;

extern declaration in global.h: extern uint8_t ui8_g_global_variable;

To goal is to keep the number of global variables at a minimum. All the remaining variables should be static variables (if possible static function variables).