AVR I2C

AVRs can act as the Controller or the Target on an I2C bus. In this part, I’ll be impending the Controller side. Bitrate The first task is to configure the bitrate. According to the datasheet, the SCL frequency can be…

AVR C++ dev setup with CMake and Conan

Introduction Setting up a C++ development environment from scratch can be a pain. Here, I’m documenting the steps for installing all the necessary tools for building code for AVR microcontrollers. Together with a template project on GitHub, it should provide…

SFR access and unit testing

SFR access The straightforward way of accessing memory-mapped Special Function Registers (SFR) is by casting the register address to a pointer. We can also do the same in C++, potentially gaining more type safety and avoiding the standard macro pitfalls.…

Duna

I made this project a while back, after Perseverance landed on Mars. I had an old LCD screen and an unused Raspberry Pi, and I thought it would be neat to have a slideshow of images from Mars on my…

AVR 16-bit Timers in C++

Low-level access There are 2 types of timer/counters typical to most 8-bit AVR microcontrollers: 8-bit (typically Timer0) and 16-bit (Timer1). Additional instances are almost identical, with the same register layouts, so it makes sense to represent them with the same…

Project Liquid

Whenever I start another microcontroller project, I find myself writing the same code all over again – setting up peripherals, looking up pin mapping, etc. Everybody does, probably. I then try to reuse the code from my older projects or…