-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start adding embedded coding standard
- Loading branch information
1 parent
e3888d0
commit 132e56a
Showing
1 changed file
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
Embedded (Firmware) Coding Standard | ||
=================================== | ||
*********************************** | ||
|
||
Coding Style | ||
============ | ||
|
||
Use snake case for variable and function name (snake_case) | ||
100 character max per line | ||
Use const and #define instead of magic number | ||
|
||
Include Order | ||
------------- | ||
* C Standard Library (e.g. <stdint.h>) | ||
* Platform specific system header (e.g. <xc.h>) | ||
* Project local header file (e.g. "imu.h") | ||
|
||
Include Guards | ||
-------------- | ||
|
||
For most firmware: | ||
|
||
.. code-block:: c | ||
#ifndef _FILENAME_H | ||
#define _FILENAME_H | ||
/* Your code here */ | ||
#endif | ||
For firmware libraries: | ||
|
||
.. code-block:: c | ||
#ifndef _LIBRARY_FILENAME_H | ||
#define _LIBRARY_FILENAME_H | ||
/* Your code here */ | ||
#endif | ||
Formatting | ||
---------- | ||
Just use `team-wide clang-format config <https://github.com/waterloo-rocketry/rocketlib/blob/master/.clang-format>`_ | ||
|
||
|