Skip to main content

Software

Git

ECE 398 uses Git, a distributed version control system to manage code and track changes. There are a couple tools listed below for its use. You can also check out this link:

learngitbranching.js.org/

For a tutorial on how branching works. It's a good introduction to git as a version control system.

Development

The following are some software stackups that have been used by other projects in the past.

  • Platformio - A popular IDE for embedded development that supports multiple platforms including Arduino.
  • VSCode - A lightweight but powerful source code editor with support for many programming languages and extensions.
  • MkDocs Material - Easy to manage documentation generator to make documentation websites.
  • GitHub - A web-based platform used for version control and collaboration.
  • GitHub Desktop - A git client that can be used for version control and collaboration.
  • OnShape - A cloud-based CAD platform for mechanical design.
  • KiCad - Open source PCB design software for making custom PCBs.
  • ClickUp - A project management tool.

Note Taking

These are some options for note-taking software:

  • Obsidian - Powerful local note-taking application using markdown support. Stores notes locally, in Markdown files.
  • Notion - Cloud based note-taking and organization tool. More powerful than Obsidian, but typically requires and internet connection. Supports database features as well.
  • Notes in a Folder - Sometimes nothing beats the simplest solution of a bunch of folders with text files in them.

Language Overview

Different languages and their common use-cases.

C/C++

C and C++ are the most common embedded systems and system-level programming languages. Use C/C++ if your project requires speed and hardware access.

Good For:

  • Real-time systems
  • Embedded systems with lots of external hardware interaction
  • Fast processing

Not Great For:

  • Rapid prototyping
  • Tasks where time doesn't matter

Sample:

C

#include <stdio.h>

int main()
{
printf("Hello, world!\n");
}

C++

#include <iostream>

int main()
{
std::cout << "Hello, world!" << std::endl;
}

Python

Python is an easy-to-use high-level programming language that runs on an interpreter. Python does not compile to machine code, so it requires extra overhead that C/C++ does not.

Great For:

  • Rapid prototyping
  • Data analysis
  • Machine learning
  • Scripts

Not Great For:

  • Performance-critical applications
  • Low-level hardware interaction

Sample

print("Hello, world!")

Style Guides

Recommended standards on how to format code that is used in ECE398 VIP projects.

Python

For python, follow the PEP 8 style guide.

In order to do this automatically, without you, the programmer, having to do any reading, we recommend the use of autopep8. You can run the formatter by opening the command palette ctrl+shift+p and typing "Format Document". If you so please, you can also configure VsCode to format the document every time the document is saved.

Example of PEP8 formatted code:


class Circle:
"""A simple Circle class."""

def __init__(self, radius):
self.radius = radius

def area(self):
"""Calculate the area of the circle."""
return math.pi * self.radius ** 2


def print_circle_area(radius):
"""Print the area of a circle with the given radius."""
circle = Circle(radius)
area = circle.area()
print(f"Area of the circle with radius {radius}: {area:.2f}")


if __name__ == "__main__":
radius = 5
print_circle_area(radius)
sys.exit(0)

C/C++

For C++ classes/namespaces/enums, follow the naming conventions in the Google C++ Style Guide

If writing C code with little or no C++, ECE 398 has the following style guide:

  • Use snake_case for static functions
  • Use PascalCase for function names that are exposed to other code
  • Use s_variableName for static variables
  • Use pVariableName for pointer parameters
  • Use camelCase for all other variables
  • All .h files should contain a header guard formatted like __NAME_OF_FILE_H__
  • Use SCREAMING_SNAKE_CASE for macros and enums
  • Types should be post-fixed with _t like my_type_t
  • Function pointers should be post-fixed with _fn like my_function_fn

Example of C Code

// circle.h

#ifdef __CIRCLE_H__
#define __CIRCLE_H__

typedef struct {
float radius;
} circle_t;

float circle_get_area(circle_t *pCircle)

#endif // __CIRCLE_H__
// circle.c
#include "circle.h"

float
circle_get_area(circle_t *pCircle)
{
return 3.14 * pCircle->radius * pCircle->radius;
}
// main.c

#include "circle.h"

static float s_radius = 1.0f;

static void print_radius();

int
main()
{
print_radius();
}

void
print_radius()
{
circle_t circle = {0};
circle.radius = s_radius;

printf("%0.2f\n", circle_get_radius(&circle));
}

Example of C++ Code

// main.cpp
#include <iostream>
#include <cmath>

class Circle {
public:
explicit Circle(double r) : radius(r) {}

double area() const {
return M_PI * radius * radius;
}

private:
double radius;
};

void printCircleArea(double radius) {
Circle circle(radius);
double area = circle.area();
std::cout << "Area of the circle with radius " << radius << ": " << area << std::endl;
}

int main() {
double radius = 5.0;
printCircleArea(radius);
return 0;
}