Skip to content

Commit

Permalink
Start adding embedded coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonBrave committed Oct 6, 2024
1 parent e3888d0 commit 132e56a
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion general/standards/embedded-coding-standard.rst
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>`_


0 comments on commit 132e56a

Please sign in to comment.