From 132e56acc7e4795ba6eaf2b60d7ff16359b4952c Mon Sep 17 00:00:00 2001 From: Jason Xu <40355221+JasonBrave@users.noreply.github.com> Date: Sun, 6 Oct 2024 12:42:10 -0400 Subject: [PATCH] Start adding embedded coding standard --- .../standards/embedded-coding-standard.rst | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/general/standards/embedded-coding-standard.rst b/general/standards/embedded-coding-standard.rst index d1d9891..7902035 100644 --- a/general/standards/embedded-coding-standard.rst +++ b/general/standards/embedded-coding-standard.rst @@ -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. ) +* Platform specific system header (e.g. ) +* 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 `_ + +