/
Coding Style

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 http://openwsn-berkeley.github.io/.

/**
\brief Short description of file.

\author Full Name <your@emailaddress.edu>, 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
   function).

\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 http://openwsn-berkeley.github.io/. For more examples of Sphinx documentation, see the Sphinx Module-specific markup page and the Python Sphinx documentation page.

# license: https://openwsn.atlassian.net/wiki/display/OW/License
'''
Introductory text to this module
 
.. moduleauthor:: First Last <first.last@domain.com>
'''

#============================ 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

Related content

Source Code Documentation
Source Code Documentation
Read with this
Workflow
Workflow
Read with this
Develop
Develop
Read with this
Builders
Builders
Read with this
Tune parameters in OpenWSN
Tune parameters in OpenWSN
Read with this
OpenVisualizer
OpenVisualizer
Read with this