...
A typical sample application source code file is organized as follows:
Gliffy | ||||
---|---|---|---|---|
|
...
|
Module Variables
By convention, the variables of a module are grouped into a structure declared globally at the beginning of the file.
...
- It reduces name collision with variables from other modules.
- It allows a developer to watch all the variables at once during debug by watching a single structure.
It allows different functions to easily access the same variables without requiring pointers to be passed between functions.
Note If different tasks access the same variables, make sure to protect the access to the variables, for example through a semaphoremutex.
- Since The stack space does not need to change when variables are added/removed, since modules variables are statically allocated , rather than allocated from a task's stack, the stack space does not need to change when variables are added/removed.
- These variables This structure can include the declaration of the stack space for the different tasks, which need to be done globally.
...
- 4 spaces are used for indentation. Tabulations Tabs are never used.
- Source code is written to not exceed a width of 80 columns.
- Selected function functions are commented using Doxygen syntax.