Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Style guide should be followed for all C/C++ code developed for WARG. Generally, we want to follow the guide set by BAARS C or MISRA C, although generally our style follows that of the google c++ guide. https://google.github.io/styleguide/cppguide.html. A .clang-format will be uploaded soon.

Table of Contents

File Naming

With the introduction of ZP and LOS, there’s an increased pressure to name well. Please refer to the ZP / LOS architecture spec for directory structure.

Zeropilot

Zeropilot file names should be prefixed by their corresponding category, and then be in Pascal Case. I.E:

Code Block
AM_Interface.cpp // Attitude Manager Interface
SF_MahonyFilter.hpp // Sensor Fusion Mahony Filter

There should be very few exceptions to this rule. Try to make names descriptive and follow our design pattern.

Laminar OS

LaminarOS is a bit more difficult. For interface layers, the name of the file should be prefixed only by LOS_:

Code Block
LOS_Link.cpp // RC-Link interface
LOS_Pos.cpp // LOS Position interface
LOS_Telem.hpp // LOS Telemetry interface

LOS Core and LOS Driver layers should be prefixed by LOS_C_ and LOS_D_ respectively. Los CORE generally will have names of protocols, please follow the naming conventions for those protocols, otherwise use all uppercase. Drivers should be in all lowercase (since a lot of these will also be names like PPM or CRSF, but using all caps makes it easier to confuse with core)

Code Block
LOS_C_I2C.Xpp
LOS_C_GPIO.Xpp
LOS_C_UART.Xpp
LOS_C_TIM.Xpp
LOS_D_imu.Xpp
LOS_D_ppm.Xpp
LOS_D_xbees.Xpp

Formatting

Spacing

We use 4 spaces instead of tabs here.

...