Skip to content

larsimmisch/arduino--

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arduino--

arduino-- is a C++ library for AVR microcontrollers.

The project got kicked off by this blog post by Ben Laurie, Grown-up Arduino programming.

In a nutshell, the idea is to move as much work as possible into the compilation phase via C++ templates, and have a system where toggling an output pin in C++ compiles down to a single assembler instruction, while still having an abstraction layer that is at least very similar between devices.

This is what hello world - blinking an LED - looks like:

/*
 The hello world of arduino--, a C++ take on the Arduino libraries.

 Blinks an LED connected to digital pin 13 (which is connected to an LED
 on all Arduino variants that we know of).
 */

#include "arduino--.h"
#include <avr/sleep.h>

int main(void)
    {
    // Arduino Pin D13 is an output
    Arduino::D13::modeOutput();

    while(true)
        {
        // toggle the pin
        Arduino::D13::toggle();
        // wait
        _delay_ms(2000);
        }

    return 0;
    }

Getting started

Prerequisites

  • avrdude
  • avr-gcc
  • avr-binutils
  • avr-libc
  • perl
  • python

On a Mac, installation via Homebrew is recommended:

brew tap osx-cross/avr
brew install avr-gcc

This will automatically install avr-binutils and avr-libs, too.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 45.1%
  • C++ 44.6%
  • C 4.6%
  • Python 4.4%
  • Makefile 1.2%
  • SWIG 0.1%