Atlib – getting started

This is a small but powerful C++ library (AVR GCC) which gives you some standard features like GPIO/UART/SPI/TWI. You can use it in your AVR-based projects. Library is focused on a good GPIO management and external driver integration on various Atmel microcontrollers. What makes it a perfect tool for rapid prototyping. Library is extremely easy in use and helps beginners in better understanding of AVR internals. Code in on GitHub, click here.

How to use library ?

This is quite simple. You have the source code of the library you want to use and you simply have to compile it together with your existing code (i.e. main.cpp file).

$ avr-g++ -Wall -fno-exceptions -ansi --pedantic -ffunction-sections \
    -Wl,--gc-sections -g -Os -fdata-sections -fno-threadsafe-statics \
    -mmcu=atmega8 -DF_CPU=16000000 -I. \
    -I./atlib/inc -o prog.o main.cpp ./atlib/src/io.cpp
$ avr-objcopy -j .text -j .data -O ihex prog.o prog.hex    
$ avr-ld prog.o -o prog.elf
$ avr-size -C --mcu=atmega8 prog.elf

Example Program

 * Copyright (c) 2017, Łukasz Marcin Podkalicki <>
 * Example code of using driver AD9850.

#include <at/driver/AD9850.hpp>

using namespace at;

AD9850 dds(/*reset=*/_PB0, /*fqfp=*/_PB1, /*wclk=*/_PB2, /*d7=*/_PB3);

	/* setup */

	/* set frequency 12345Hz */

	/* loop */
	while (1);


Leave a Comment