From e9714261c347f53e61a9a472415e87a81d72fa7d Mon Sep 17 00:00:00 2001 From: David O'Connor Date: Sat, 26 Mar 2022 16:11:03 -0400 Subject: [PATCH] Added doc comment to styleguide --- docs/development/CodingStyle.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/development/CodingStyle.md b/docs/development/CodingStyle.md index bc51b8c77..96490f1bf 100644 --- a/docs/development/CodingStyle.md +++ b/docs/development/CodingStyle.md @@ -302,6 +302,34 @@ Do not include things you are not using. `#pragma once` ([see wiki](https://en.wikipedia.org/wiki/Pragma_once)) is preferred over `#include guards` to avoid multiple includes. +# Documentation comments + +All new code files, structs, enums, and functions should include a comment at its top describing its purpose. +All PRs that modify existing items should add a comment if not already present, and update it if applicable due +to changes made by the PR. These comments may be ommitted if the item is trivial or self-explanatory. + +Example file-level comment: + +```c +/* This file contains code used to send DSHOT commands using the STM timer's burst DMA functionality. +* It uses DMA to alter timer PWM duty cycle. For an alternative approach, see `drivers/dshot_bitbang.c` +for a DSHOT implementation that uses GPIO bitbanging. +*/ +``` + +Example enum-level comment: +```c +/* +* Describes allocation of ELRS telemetry packets, and is associated with time between telemetry +* packet transmission. +* See [ELRS: Telemetry Bandwidth](https://www.expresslrs.org/1.0/info/telem-bandwidth/) for more information. +*/ +typedef enum { + TLM_RATIO_NO_TLM = 0, + // .. +``` + + # Other details No trailing whitespace at the end of lines or at blank lines. -- 2.11.4.GIT