Coding Style

Many people have and are contributing to the OpenWSN project. It is important to keep a consistent look-and-feel across the different contributions.

This page provides the following:

C Coding Style

Firmware documentation is automatically generated by Doxygen, and published nightly at

\brief Short description of file.

\author Full Name <>, September 2013.
//=========================== variables =======================================
typedef struct {
   uint16_t elem1;
   uint16_t elem2;
   uint16_t elem3;
} local_vars_t;
local_vars_t local_vars;
//=========================== prototypes ======================================
uint16_t function(uint16_t param1, uint16_t* param2, uint16_t* param3);
//=========================== public ==========================================
//=========================== private =========================================
\brief Description function (one sentence).
Longer description function
\note Something important to know.

\param[in]     param1 Input parameter (i.e. read by this function).
\param[out]    param2 Output parameter (i.e. modified by this function).
\param[in,out] param3 Input/output parameter (i.e. read and modified by this

\return Description of return value.
uint16_t function(uint16_t param1, uint16_t* param2, uint16_t* param3) {
   uint8_t     i;
   return returnVal;

Python Coding Style

Software documentation is automatically generated by Sphinx, and published nightly at For more examples of Sphinx documentation, see the Sphinx Module-specific markup page and the Python Sphinx documentation page.

# license:
Introductory text to this module
.. moduleauthor:: First Last <>

#============================ import ==========================================

import os

#============================ body ============================================

class MyClass(object):
    Description of class.
    def myMethod(self,myParam,myKey="value"):
        Description of method.
        .. note::
          Something to note.
        :param myParam: Description of myParam
        :type  myParam: str
        :key   myKey:   Description of myKey
        :type  myKey:   str
        :raise:         Description of exception raised.
        :returns:       Description of the return value.
        :rtype:         Return type.
        return None