Open-source, hacker-friendly, education-oriented library
for Atmel's ATSAM4L ARM microcontrollers
Overview Getting started
(   This website is currently under construction, feel free to look around but be aware that some pages might be missing!)
Atmel's ATSAM4L
  • 32-bit ARM architecture
  • Up to 48MHz
  • Up to 64Kb RAM and 512Kb Flash
  • Multiple USART, I2C and SPI controllers
  • Native USB (Device and Host)
  • DMA
  • ADCs, DAC, timers, touchscreen controller, random number generator, and a lot more...
Modules reference
Open the box
  • Really open-source : please come in!
  • Permissive Apache 2.0 license
  • Hackers-friendly : well-commented modules and datasheet references to help tinkering
  • Beginners-friendly : in-depth tutorials and documentation to learn how it works inside
  • Designed for learning, prototyping, and overall, building cool stuff
  • Keep It Super Simple : pure C++11, no complicated dependencies, no compilation hacks, no obscure preprocessor nonsense
Philosophy
Go further
  • Datasheet overview : tame this scary document
  • Powerful in-system debugging with GDB over JTAG/SWD
  • Carbide : open-source board to get you started quickly
  • Easy customization of the library
GDB tutorial
Hello World!
blink.cpp
#include <core.h>
#include <gpio.h>

int main() {
    // Init the microcontroller
    Core::init();

    // Define the pin on which the LED is connected
    // On Carbide, this is the red LED
    GPIO::Pin led = GPIO::PA00;

    // Enable this pin in output to a HIGH state
    GPIO::enableOutput(led, GPIO::HIGH);

    while (1) {
        // Turn the LED on
        GPIO::setLow(led);

        // Wait for half a second
        Core::sleep(500);

        // Turn the LED off
        GPIO::setHigh(led);

        // Wait for half a second
        Core::sleep(500);
    }
}
Makefile
NAME=blink

# Available modules : adc dac eic gloc i2c spi tc trng usart.
# Some modules such as gpio and flash are already compiled by default
# and must not be added here.
MODULES=

# User-defined modules to compile with your project
USER_MODULES=

# The toolchain's bin/ path, don't forget to customize it.
# If this directory is already in your PATH, comment this line.
TOOLCHAIN_PATH=/opt/arm-none-eabi/bin/

# Include the main lib makefile
include libtungsten/Makefile
In a (nut)shell :
  • mkdir blink
  • cd blink
  • git clone git@github.com:Foalyy/libtungsten.git
  • wget https://libtungsten.io/static/code/examples/blink/blink.cpp
  • wget https://libtungsten.io/static/code/examples/blink/Makefile
  • vim Makefile # Check TOOLCHAIN_PATH
  • make upload # Or make autoflash with a JTAG/SWD adapter
Looks interesting?