Git Product home page Git Product logo

elec3300-rhythm-synthesiser's Introduction

Rhythm Synthesiser

An ELEC3300 project.

Indentation and spacing

  • Indent 2 spaces
  • End file with newline

Comments

// Use single line comments even if
// the comment spans multiple lines

/* Don't use block style comments */

Use 80 backslashes above and below to create a title comment:

////////////////////////////////////////////////////////////////////////////////
// Title comment example
////////////////////////////////////////////////////////////////////////////////

Naming

Integral types

Use integer typedefs instead of primitive types:

// Include stdint header if needed
#include <stdint.h>

int8_t x; // not char x
int16_t x; // not short x
int32_t x; // not int x

uint8_t x4; // not unsigned char x
uint16_t x5; // not unsigned short x
uint32_t x6; // not unsigned int x

Static functions and variables

Use lower camel case:

static int32_t staticVariableExample = 0;

void staticFunctionExample(void) {}

Exported functions and variables

Use uppercase with underscores:

extern int32_t EXPORTED_VARIABLE_EXAMPLE;

void EXPORTED_FUNCTION_EXAMPLE(void) {}

Include guards

Use uppercase with underscores, with double underscore prefix:

#ifndef __INCLUDE_GUARD_EXAMPLE_H
#define __INCLUDE_GUARD_EXAMPLE_H

Source file ordering

  1. Include project dependencies
  2. Include library dependencies
  3. Define static variables
  4. Define static functions
  5. Define exported variables
  6. Define exported functions
#include "example1.h"
#include "example2.h"

#include "stm32f10x_gpio.h"
#include "stm32f10x_tim.h"

////////////////////////////////////////////////////////////////////////////////
// Static
////////////////////////////////////////////////////////////////////////////////

static int32_t staticVariableExample = 0;

void staticFunctionExample(void) {}

////////////////////////////////////////////////////////////////////////////////
// Exported
////////////////////////////////////////////////////////////////////////////////

int32_t EXPORTED_VARIABLE_EXAMPLE = staticVariableExample;

void EXPORTED_FUNCTION_EXAMPLE(void) {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.